aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1995-06-20 14:25:36 +0000
committerRichard M. Stallman1995-06-20 14:25:36 +0000
commit0de84e16f194ac5db9079b0884ad0b9fb7d494b6 (patch)
treedb9a33eff9dbfe9cf35856a7439c305bf6615bc0
parent2e792253035450fdcf6f05c372d88f3c79374436 (diff)
downloademacs-0de84e16f194ac5db9079b0884ad0b9fb7d494b6.tar.gz
emacs-0de84e16f194ac5db9079b0884ad0b9fb7d494b6.zip
(universal-argument-num-events): New variable.
(universal-argument, universal-argument-more, negative-argument) (digit-argument): Set that variable. (universal-argument-other-key): Use that variable when unreading.
-rw-r--r--lisp/simple.el16
1 files changed, 14 insertions, 2 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index a737c70904e..cb0cea0c67c 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -955,6 +955,11 @@ In either case, the output is inserted after point (leaving mark after it)."
955 map) 955 map)
956 "Keymap used while processing \\[universal-argument].") 956 "Keymap used while processing \\[universal-argument].")
957 957
958(defvar universal-argument-num-events nil
959 "Number of argument-specifying events read by `universal-argument'.
960`universal-argument-other-key' uses this to discard those events
961from (this-command-keys), and reread only the final command.")
962
958(defun universal-argument () 963(defun universal-argument ()
959 "Begin a numeric argument for the following command. 964 "Begin a numeric argument for the following command.
960Digits or minus sign following \\[universal-argument] make up the numeric argument. 965Digits or minus sign following \\[universal-argument] make up the numeric argument.
@@ -964,6 +969,7 @@ Repeating \\[universal-argument] without digits or minus sign
964 multiplies the argument by 4 each time." 969 multiplies the argument by 4 each time."
965 (interactive) 970 (interactive)
966 (setq prefix-arg (list 4)) 971 (setq prefix-arg (list 4))
972 (setq universal-argument-num-events (length (this-command-keys)))
967 (setq overriding-terminal-local-map universal-argument-map)) 973 (setq overriding-terminal-local-map universal-argument-map))
968 974
969;; A subsequent C-u means to multiply the factor by 4 if we've typed 975;; A subsequent C-u means to multiply the factor by 4 if we've typed
@@ -973,7 +979,8 @@ Repeating \\[universal-argument] without digits or minus sign
973 (if (consp arg) 979 (if (consp arg)
974 (setq prefix-arg (list (* 4 (car arg)))) 980 (setq prefix-arg (list (* 4 (car arg))))
975 (setq prefix-arg arg) 981 (setq prefix-arg arg)
976 (setq overriding-terminal-local-map nil))) 982 (setq overriding-terminal-local-map nil))
983 (setq universal-argument-num-events (length (this-command-keys))))
977 984
978(defun negative-argument (arg) 985(defun negative-argument (arg)
979 "Begin a negative numeric argument for the next command. 986 "Begin a negative numeric argument for the next command.
@@ -985,6 +992,7 @@ Repeating \\[universal-argument] without digits or minus sign
985 (setq prefix-arg nil)) 992 (setq prefix-arg nil))
986 (t 993 (t
987 (setq prefix-arg '-))) 994 (setq prefix-arg '-)))
995 (setq universal-argument-num-events (length (this-command-keys)))
988 (setq overriding-terminal-local-map universal-argument-map)) 996 (setq overriding-terminal-local-map universal-argument-map))
989 997
990(defun digit-argument (arg) 998(defun digit-argument (arg)
@@ -1000,6 +1008,7 @@ Repeating \\[universal-argument] without digits or minus sign
1000 (setq prefix-arg (if (zerop digit) '- (- digit)))) 1008 (setq prefix-arg (if (zerop digit) '- (- digit))))
1001 (t 1009 (t
1002 (setq prefix-arg digit)))) 1010 (setq prefix-arg digit))))
1011 (setq universal-argument-num-events (length (this-command-keys)))
1003 (setq overriding-terminal-local-map universal-argument-map)) 1012 (setq overriding-terminal-local-map universal-argument-map))
1004 1013
1005;; For backward compatibility, minus with no modifiers is an ordinary 1014;; For backward compatibility, minus with no modifiers is an ordinary
@@ -1015,7 +1024,10 @@ Repeating \\[universal-argument] without digits or minus sign
1015(defun universal-argument-other-key (arg) 1024(defun universal-argument-other-key (arg)
1016 (interactive "P") 1025 (interactive "P")
1017 (setq prefix-arg arg) 1026 (setq prefix-arg arg)
1018 (setq unread-command-events (list last-input-event)) 1027 (let* ((key (this-command-keys))
1028 (keylist (listify-key-sequence key)))
1029 (setq unread-command-events
1030 (nthcdr universal-argument-num-events keylist)))
1019 (reset-this-command-lengths) 1031 (reset-this-command-lengths)
1020 (setq overriding-terminal-local-map nil)) 1032 (setq overriding-terminal-local-map nil))
1021 1033