From: David Kastrup Date: Sat, 25 Jul 2015 16:54:42 +0000 (+0200) Subject: ; Do not overwrite preexisting contents of unread-command-events X-Git-Tag: emacs-25.0.90~1377 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5022e27dac4c13651941e425dbec5b3a2cecdae4;p=emacs.git ; Do not overwrite preexisting contents of unread-command-events --- diff --git a/lisp/comint.el b/lisp/comint.el index de220619751..7db297a1427 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -1051,7 +1051,7 @@ See also `comint-read-input-ring'." (let ((ch (read-event))) (if (eq ch ?\s) (set-window-configuration conf) - (setq unread-command-events (list ch))))))) + (push ch unread-command-events)))))) (defun comint-regexp-arg (prompt) @@ -3365,7 +3365,8 @@ the completions." (set-window-configuration comint-dynamic-list-completions-config)) (if (eq first ?\s) (set-window-configuration comint-dynamic-list-completions-config) - (setq unread-command-events (listify-key-sequence key))))))) + (setq unread-command-events + (nconc (listify-key-sequence key) unread-command-events))))))) (defun comint-get-next-from-history () "After fetching a line from input history, this fetches the following line. diff --git a/lisp/double.el b/lisp/double.el index b06f59cf6a6..ee511e55963 100644 --- a/lisp/double.el +++ b/lisp/double.el @@ -122,9 +122,10 @@ but not `C-u X' or `ESC X' since the X is not the prefix key." (append (make-list (1- (length (nth 1 entry))) 127) (nth 2 entry) - '(magic-end))) + '(magic-end) + unread-command-events)) (vector 127)) - (setq unread-command-events (list new)) + (push new unread-command-events) [ignore]))) ((eq key 'magic-end) ;; End of double event. Ignore. @@ -134,7 +135,8 @@ but not `C-u X' or `ESC X' since the X is not the prefix key." (let ((exp (nth 1 (assoc key double-map)))) (setq double-last-event key) (setq unread-command-events - (append (substring exp 1) '(magic-start))) + (append (substring exp 1) '(magic-start) + unread-command-events)) (vector (aref exp 0))))))) ;;; Mode diff --git a/lisp/ebuff-menu.el b/lisp/ebuff-menu.el index 337ea10f26d..93418063d10 100644 --- a/lisp/ebuff-menu.el +++ b/lisp/ebuff-menu.el @@ -133,7 +133,7 @@ Run hooks in `electric-buffer-menu-mode-hook' on entry. (setq select (catch 'electric-buffer-menu-select (message "<<< Type SPC or RET to bury the buffer list >>>") - (setq unread-command-events (list (read-event))) + (push (read-event) unread-command-events) (let ((start-point (point)) (first (progn (goto-char (point-min)) (unless Buffer-menu-use-header-line @@ -210,7 +210,9 @@ See the documentation of `electric-buffer-list' for details." (defun Electric-buffer-menu-exit () (interactive) - (setq unread-command-events (listify-key-sequence (this-command-keys))) + (setq unread-command-events + (nconc (listify-key-sequence (this-command-keys)) + unread-command-events)) ;; for robustness (condition-case () (throw 'electric-buffer-menu-select nil) diff --git a/lisp/ehelp.el b/lisp/ehelp.el index 66e4f5c633b..2e15af34a81 100644 --- a/lisp/ehelp.el +++ b/lisp/ehelp.el @@ -204,10 +204,10 @@ BUFFER is put back into its original major mode." (catch 'exit (if (pos-visible-in-window-p (point-max)) (progn (message "%s" (substitute-command-keys "<<< Press Space to bury the help buffer, Press \\[electric-help-retain] to retain it >>>")) - (if (equal (setq unread-command-events (list (read-event))) - '(?\s)) - (progn (setq unread-command-events nil) - (throw 'exit t))))) + (let ((ev (read-event))) + (if (equal ev ?\s) + (throw 'exit t) + (push ev unread-command-events))))) (let (up down both neither (standard (and (eq (key-binding " " nil t) 'scroll-up) diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el index 1cdf6d69714..9f070c33db3 100644 --- a/lisp/eshell/em-hist.el +++ b/lisp/eshell/em-hist.el @@ -520,7 +520,7 @@ See also `eshell-read-history'." (let ((ch (read-event))) (if (eq ch ?\ ) (set-window-configuration conf) - (setq unread-command-events (list ch)))))))) + (push ch unread-command-events))))))) (defun eshell-hist-word-reference (ref) "Return the word designator index referred to by REF." diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index d83eaddf165..ffe9a211417 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -6871,11 +6871,13 @@ KEY is a string or a vector." (with-current-buffer gnus-article-current-summary (setq unread-command-events (if (featurep 'xemacs) - (append key nil) - (mapcar (lambda (x) (if (and (integerp x) (>= x 128)) - (list 'meta (- x 128)) - x)) - key))) + (append key unread-command-events) + (nconc + (mapcar (lambda (x) (if (and (integerp x) (>= x 128)) + (list 'meta (- x 128)) + x)) + key) + unread-command-events))) (let ((cursor-in-echo-area t) gnus-pick-mode) (describe-key (read-key-sequence nil t)))) @@ -6893,11 +6895,13 @@ KEY is a string or a vector." (with-current-buffer gnus-article-current-summary (setq unread-command-events (if (featurep 'xemacs) - (append key nil) - (mapcar (lambda (x) (if (and (integerp x) (>= x 128)) - (list 'meta (- x 128)) - x)) - key))) + (append key unread-command-events) + (nconc + (mapcar (lambda (x) (if (and (integerp x) (>= x 128)) + (list 'meta (- x 128)) + x)) + key) + unread-command-events))) (let ((cursor-in-echo-area t) gnus-pick-mode) (describe-key-briefly (read-key-sequence nil t) insert))) diff --git a/lisp/info.el b/lisp/info.el index 48d9d1981af..0a2206d61bf 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -3825,7 +3825,7 @@ with a list of packages that contain all specified keywords." (message (if flag "Type Space to see more" "Type Space to return to Info")) (if (not (eq ?\s (setq ch (read-event)))) - (progn (setq unread-command-events (list ch)) nil) + (progn (push ch unread-command-events) nil) flag)) (scroll-up))) (bury-buffer "*Help*"))) diff --git a/lisp/international/quail.el b/lisp/international/quail.el index 90a540aae30..f60af4ab9b6 100644 --- a/lisp/international/quail.el +++ b/lisp/international/quail.el @@ -1415,7 +1415,8 @@ Return the input string." ;; KEYSEQ is not defined in the translation keymap. ;; Let's return the event(s) to the caller. (setq unread-command-events - (string-to-list (this-single-command-raw-keys))) + (append (this-single-command-raw-keys) + unread-command-events)) (setq quail-translating nil)))) (quail-delete-region) quail-current-str) @@ -1491,7 +1492,8 @@ Return the input string." ;; KEYSEQ is not defined in the conversion keymap. ;; Let's return the event(s) to the caller. (setq unread-command-events - (string-to-list (this-single-command-raw-keys))) + (append (this-single-command-raw-keys) + unread-command-events)) (setq quail-converting nil)))) (setq quail-translating nil) (if (overlay-start quail-conv-overlay) diff --git a/lisp/international/robin.el b/lisp/international/robin.el index 8254180fcc1..0ef90b18932 100644 --- a/lisp/international/robin.el +++ b/lisp/international/robin.el @@ -466,7 +466,7 @@ While this input method is active, the variable (list key) (delete-region start (point)) (if key - (setq unread-command-events (list key))) + (push key unread-command-events)) (if (stringp output) (string-to-list output) (list output)))))) diff --git a/lisp/kmacro.el b/lisp/kmacro.el index 327cf455e65..9636a36b1e2 100644 --- a/lisp/kmacro.el +++ b/lisp/kmacro.el @@ -432,7 +432,7 @@ Optional arg EMPTY is message to print if no macros are defined." (setq last-input-event nil))) (when last-input-event (clear-this-command-keys t) - (setq unread-command-events (list last-input-event)))) + (push last-input-event unread-command-events))) (defun kmacro-get-repeat-prefix () diff --git a/lisp/language/hanja-util.el b/lisp/language/hanja-util.el index 8b62ee707f3..c9501d2ef8f 100644 --- a/lisp/language/hanja-util.el +++ b/lisp/language/hanja-util.el @@ -6585,7 +6585,9 @@ The value is a hanja character that is selected interactively." (cmd (lookup-key hanja-keymap seq))) (if (functionp cmd) (funcall cmd) - (setq unread-command-events (listify-key-sequence seq)) + (setq unread-command-events + (nconc (listify-key-sequence seq) + unread-command-events)) (throw 'exit-input-loop nil)))))) (setq hanja-conversions nil)))) diff --git a/lisp/leim/quail/hangul.el b/lisp/leim/quail/hangul.el index 12d7358841b..56a244f4574 100644 --- a/lisp/leim/quail/hangul.el +++ b/lisp/leim/quail/hangul.el @@ -410,7 +410,9 @@ When a Korean input method is off, convert the following hangul character." ((commandp cmd) (call-interactively cmd)) (t - (setq unread-command-events (listify-key-sequence seq)) + (setq unread-command-events + (nconc (listify-key-sequence seq) + unread-command-events)) (throw 'exit-input-loop nil)))))) (quail-delete-overlays))))) @@ -454,7 +456,9 @@ When a Korean input method is off, convert the following hangul character." ((commandp cmd) (call-interactively cmd)) (t - (setq unread-command-events (listify-key-sequence seq)) + (setq unread-command-events + (nconc (listify-key-sequence seq) + unread-command-events)) (throw 'exit-input-loop nil)))))) (quail-delete-overlays))))) @@ -499,7 +503,9 @@ When a Korean input method is off, convert the following hangul character." ((commandp cmd) (call-interactively cmd)) (t - (setq unread-command-events (listify-key-sequence seq)) + (setq unread-command-events + (nconc (listify-key-sequence seq) + unread-command-events)) (throw 'exit-input-loop nil)))))) (quail-delete-overlays))))) diff --git a/lisp/leim/quail/japanese.el b/lisp/leim/quail/japanese.el index fd6628b8a45..831725f8065 100644 --- a/lisp/leim/quail/japanese.el +++ b/lisp/leim/quail/japanese.el @@ -59,8 +59,9 @@ (setq quail-current-str (aref quail-current-key 0)))) (if (integerp control-flag) (setq unread-command-events - (string-to-list - (substring quail-current-key control-flag))))))) + (append + (substring quail-current-key control-flag) + unread-command-events)))))) control-flag) ;; Convert Hiragana <-> Katakana in the current translation region. @@ -103,7 +104,7 @@ (defun quail-japanese-self-insert-and-switch-to-alpha (key idx) (quail-delete-region) - (setq unread-command-events (list (aref key (1- idx)))) + (push (aref key (1- idx)) unread-command-events) (quail-japanese-switch-package "q" 1)) (defvar quail-japanese-switch-table diff --git a/lisp/leim/quail/lao.el b/lisp/leim/quail/lao.el index 52357afd8dd..14cf9268287 100644 --- a/lisp/leim/quail/lao.el +++ b/lisp/leim/quail/lao.el @@ -36,8 +36,9 @@ (buffer-substring (overlay-start quail-overlay) (overlay-end quail-overlay)) unread-command-events - (string-to-list - (substring quail-current-key control-flag))) + (append + (substring quail-current-key control-flag) + unread-command-events)) (setq quail-current-str (compose-string (quail-lookup-map-and-concat quail-current-key)))) control-flag) diff --git a/lisp/leim/quail/lrt.el b/lisp/leim/quail/lrt.el index 342b52d6ab6..ed9138d2134 100644 --- a/lisp/leim/quail/lrt.el +++ b/lisp/leim/quail/lrt.el @@ -41,8 +41,9 @@ (buffer-substring (overlay-start quail-overlay) (overlay-end quail-overlay)) unread-command-events - (string-to-list - (substring quail-current-key control-flag))) + (append + (substring quail-current-key control-flag) + unread-command-events)) (let ((lao-str (lao-transcribe-roman-to-lao-string quail-current-key))) (if (> (aref lao-str 0) 255) (setq quail-current-str lao-str) diff --git a/lisp/leim/quail/tibetan.el b/lisp/leim/quail/tibetan.el index 1313f566def..5dacf290c10 100644 --- a/lisp/leim/quail/tibetan.el +++ b/lisp/leim/quail/tibetan.el @@ -50,8 +50,9 @@ (buffer-substring (overlay-start quail-overlay) (overlay-end quail-overlay)) unread-command-events - (string-to-list - (substring quail-current-key control-flag))) + (append + (substring quail-current-key control-flag) + unread-command-events)) ;; Special treatment of "-d..." and "-y...". (if (string-match "^-[dy]" quail-current-key) (setq quail-current-key (substring quail-current-key 1))) @@ -381,8 +382,9 @@ (buffer-substring (overlay-start quail-overlay) (overlay-end quail-overlay)) unread-command-events - (string-to-list - (substring quail-current-key control-flag))) + (append + (substring quail-current-key control-flag) + unread-command-events)) (let ((transcription (quail-tibkey-to-transcription quail-current-key))) (if (> (length transcription) 0) (let ((quail-current-key transcription)) diff --git a/lisp/obsolete/terminal.el b/lisp/obsolete/terminal.el index 6bab61b0f46..f1a38d20f39 100644 --- a/lisp/obsolete/terminal.el +++ b/lisp/obsolete/terminal.el @@ -291,7 +291,9 @@ Other chars following \"%s\" are interpreted as follows:\n" ;; not used. (defun te-escape-extended-command-unread () (interactive) - (setq unread-command-events (listify-key-sequence (this-command-keys))) + (setq unread-command-events + (nconc (listify-key-sequence (this-command-keys)) + unread-command-events)) (te-escape-extended-command)) (defun te-set-escape-char (c) diff --git a/lisp/obsolete/vip.el b/lisp/obsolete/vip.el index d6adbd4d421..0c345e26f80 100644 --- a/lisp/obsolete/vip.el +++ b/lisp/obsolete/vip.el @@ -462,7 +462,8 @@ ARG is used as the prefix value for the executed command. If EVENTS is a list of events, which become the beginning of the command." (interactive "P") (let (com key (old-map (current-local-map))) - (if events (setq unread-command-events events)) + (if events (setq unread-command-events + (append events unread-command-events))) (setq prefix-arg arg) (use-local-map vip-emacs-local-map) (unwind-protect @@ -518,7 +519,7 @@ obtained so far, and COM is the command part obtained so far." (while (= char ?U) (vip-describe-arg prefix-arg) (setq char (read-char))) - (setq unread-command-events (list char))) + (push char unread-command-events)) (defun vip-prefix-arg-com (char value com) "Vi operator as prefix argument." @@ -572,7 +573,7 @@ obtained so far, and COM is the command part obtained so far." (while (= char ?U) (vip-describe-arg prefix-arg) (setq char (read-char))) - (setq unread-command-events (list char))) + (push char unread-command-events)) ;; as com is non-nil, this means that we have a command to execute (if (or (= (car com) ?r) (= (car com) ?R)) ;; execute appropriate region command. diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el index 7bcf2c1759e..90f06953183 100644 --- a/lisp/pcomplete.el +++ b/lisp/pcomplete.el @@ -1112,7 +1112,7 @@ Typing SPC flushes the help buffer." (scroll-up)))) (message "")) (t - (setq unread-command-events (list event)) + (push event unread-command-events) (throw 'done nil))))) (if (and pcomplete-last-window-config pcomplete-restore-window-delay) diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 7d2f3fcb007..826b3ee73a8 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -1042,11 +1042,11 @@ In regular expressions (including character classes): cperl-can-font-lock) (defun cperl-putback-char (c) ; Emacs 19 - (set 'unread-command-events (list c))) ; Avoid undefined warning + (push c unread-command-events)) ; Avoid undefined warning (if (featurep 'xemacs) (defun cperl-putback-char (c) ; XEmacs >= 19.12 - (setq unread-command-events (list (eval '(character-to-event c)))))) + (push (eval '(character-to-event c)) unread-command-events))) (or (fboundp 'uncomment-region) (defun uncomment-region (beg end) diff --git a/lisp/progmodes/ebrowse.el b/lisp/progmodes/ebrowse.el index f91e4a741cc..8d7c8aa0267 100644 --- a/lisp/progmodes/ebrowse.el +++ b/lisp/progmodes/ebrowse.el @@ -4223,7 +4223,8 @@ NUMBER-OF-STATIC-VARIABLES:" (1+ (point))))))))) (unless non-empty (error "No tree buffers")) - (setf unread-command-events (listify-key-sequence "p")) + (setf unread-command-events + (nconc (listify-key-sequence "p") unread-command-events)) (shrink-window-if-larger-than-buffer (selected-window)) (setq buffer-read-only t)))) diff --git a/lisp/progmodes/fortran.el b/lisp/progmodes/fortran.el index 65aa7454008..83e427da790 100644 --- a/lisp/progmodes/fortran.el +++ b/lisp/progmodes/fortran.el @@ -1117,7 +1117,7 @@ See also `fortran-window-create'." (message "Type SPC to continue editing.") (let ((char (read-event))) (or (equal char ?\s) - (setq unread-command-events (list char)))))) + (push char unread-command-events))))) (fortran-window-create))) (defun fortran-split-line () diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index 50f888cb9fd..89e0b105223 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el @@ -919,7 +919,7 @@ startup file, `~/.emacs-octave'." (let ((ch (read-event))) (if (eq ch ?\ ) (set-window-configuration conf) - (setq unread-command-events (list ch))))))) + (push ch unread-command-events)))))) (defun inferior-octave-output-digest (_proc string) "Special output filter for the inferior Octave process. diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index 16e4e8ed53d..2edacf4e69a 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el @@ -8734,10 +8734,11 @@ is omitted or nil." (let ((next-input (read-char))) (if (= next-input ?-) ; four dashes (vhdl-comment-display t) - (setq unread-command-events ; pushback the char - (list (vhdl-character-to-event next-input)))))) - (setq unread-command-events ; pushback the char - (list (vhdl-character-to-event next-input))) + (push (vhdl-character-to-event next-input) + ; pushback the char + unread-command-events)))) + (push (vhdl-character-to-event next-input) ; pushback the char + unread-command-events) (vhdl-comment-insert))))) (self-insert-command count))) @@ -10755,8 +10756,8 @@ If starting after end-comment-column, start a new line." (setq code t)) (unless code (insert "--")) ; hardwire to 1 space or use vhdl-basic-offset? - (setq unread-command-events - (list (vhdl-character-to-event next-input)))))) ; pushback the char + (push (vhdl-character-to-event next-input) ; pushback the char + unread-command-events)))) (defun vhdl-comment-display (&optional line-exists) "Add 2 comment lines at the current indent, making a display comment." @@ -11310,8 +11311,8 @@ but not if inside a comment or quote." ;; delete CR which is still in event queue (if (fboundp 'enqueue-eval-event) (enqueue-eval-event 'delete-char -1) - (setq unread-command-events ; push back a delete char - (list (vhdl-character-to-event ?\177)))))))) + (push (vhdl-character-to-event ?\177) ; push back a delete char + unread-command-events)))))) (defun vhdl-template-alias-hook () (vhdl-hooked-abbrev 'vhdl-template-alias)) diff --git a/lisp/simple.el b/lisp/simple.el index 1a4bcf124db..00c25db07d7 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -693,7 +693,8 @@ any other non-digit terminates the character code and is then used as input.")) (cond ((null translated)) ((not (integerp translated)) (setq unread-command-events - (listify-key-sequence (this-single-command-raw-keys)) + (nconc (listify-key-sequence (this-single-command-raw-keys)) + unread-command-events) done t)) ((/= (logand translated ?\M-\^@) 0) ;; Turn a meta-character into a character with the 0200 bit set. @@ -713,7 +714,8 @@ any other non-digit terminates the character code and is then used as input.")) (setq done t)) ((not first) (setq unread-command-events - (listify-key-sequence (this-single-command-raw-keys)) + (nconc (listify-key-sequence (this-single-command-raw-keys)) + unread-command-events) done t)) (t (setq code translated done t))) diff --git a/lisp/subr.el b/lisp/subr.el index bfdc0ff4a13..3dd87d65617 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2539,7 +2539,8 @@ If MESSAGE is nil, instructions to type EXIT-CHAR are displayed there." (or (eq event exit-char) (eq event (event-convert-list exit-char)) (setq unread-command-events - (append (this-single-command-raw-keys)))))) + (append (this-single-command-raw-keys) + unread-command-events))))) (delete-overlay ol)))) diff --git a/lisp/term.el b/lisp/term.el index 4c829864200..06a44f29058 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -1649,7 +1649,7 @@ See also `term-read-input-ring'." (let ((ch (read-event))) (if (eq ch ?\s) (set-window-configuration conf) - (setq unread-command-events (list ch))))))) + (push ch unread-command-events)))))) (defun term-regexp-arg (prompt) @@ -4128,7 +4128,9 @@ Typing SPC flushes the help buffer." (set-window-configuration conf)) (if (eq first ?\s) (set-window-configuration conf) - (setq unread-command-events (listify-key-sequence key))))))) + (setq unread-command-events + (nconc (listify-key-sequence key) + unread-command-events))))))) ;; I need a make-term that doesn't surround with *s -mm (defun term-ansi-make-term (name program &optional startfile &rest switches) diff --git a/lisp/vc/emerge.el b/lisp/vc/emerge.el index b17d11d34a4..de25cbafb0d 100644 --- a/lisp/vc/emerge.el +++ b/lisp/vc/emerge.el @@ -3089,7 +3089,7 @@ SPC, it is ignored; if it is anything else, it is processed as a command." (let* ((echo-keystrokes 0) (c (read-event))) (if (not (eq c 32)) - (setq unread-command-events (list c))))) + (push c unread-command-events)))) (erase-buffer))))) ;; Improved auto-save file names.