Mercurial > emacs
changeset 12334:326cccb5f51a
(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.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 20 Jun 1995 14:25:36 +0000 |
parents | 5364f0b969f3 |
children | 0ab97d00e336 |
files | lisp/simple.el |
diffstat | 1 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/simple.el Tue Jun 20 13:43:22 1995 +0000 +++ b/lisp/simple.el Tue Jun 20 14:25:36 1995 +0000 @@ -955,6 +955,11 @@ map) "Keymap used while processing \\[universal-argument].") +(defvar universal-argument-num-events nil + "Number of argument-specifying events read by `universal-argument'. +`universal-argument-other-key' uses this to discard those events +from (this-command-keys), and reread only the final command.") + (defun universal-argument () "Begin a numeric argument for the following command. Digits or minus sign following \\[universal-argument] make up the numeric argument. @@ -964,6 +969,7 @@ multiplies the argument by 4 each time." (interactive) (setq prefix-arg (list 4)) + (setq universal-argument-num-events (length (this-command-keys))) (setq overriding-terminal-local-map universal-argument-map)) ;; A subsequent C-u means to multiply the factor by 4 if we've typed @@ -973,7 +979,8 @@ (if (consp arg) (setq prefix-arg (list (* 4 (car arg)))) (setq prefix-arg arg) - (setq overriding-terminal-local-map nil))) + (setq overriding-terminal-local-map nil)) + (setq universal-argument-num-events (length (this-command-keys)))) (defun negative-argument (arg) "Begin a negative numeric argument for the next command. @@ -985,6 +992,7 @@ (setq prefix-arg nil)) (t (setq prefix-arg '-))) + (setq universal-argument-num-events (length (this-command-keys))) (setq overriding-terminal-local-map universal-argument-map)) (defun digit-argument (arg) @@ -1000,6 +1008,7 @@ (setq prefix-arg (if (zerop digit) '- (- digit)))) (t (setq prefix-arg digit)))) + (setq universal-argument-num-events (length (this-command-keys))) (setq overriding-terminal-local-map universal-argument-map)) ;; For backward compatibility, minus with no modifiers is an ordinary @@ -1015,7 +1024,10 @@ (defun universal-argument-other-key (arg) (interactive "P") (setq prefix-arg arg) - (setq unread-command-events (list last-input-event)) + (let* ((key (this-command-keys)) + (keylist (listify-key-sequence key))) + (setq unread-command-events + (nthcdr universal-argument-num-events keylist))) (reset-this-command-lengths) (setq overriding-terminal-local-map nil))