; Do not overwrite preexisting contents of unread-command-events

This commit is contained in:
David Kastrup 2015-07-25 18:54:42 +02:00
parent 227e996946
commit 5022e27dac
28 changed files with 100 additions and 66 deletions

View file

@ -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.

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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."

View file

@ -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)))

View file

@ -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*")))

View file

@ -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)

View file

@ -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))))))

View file

@ -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 ()

View file

@ -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))))

View file

@ -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)))))

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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))

View file

@ -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)

View file

@ -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.

View file

@ -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)

View file

@ -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)

View file

@ -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))))

View file

@ -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 ()

View file

@ -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.

View file

@ -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))

View file

@ -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)))

View file

@ -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))))

View file

@ -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)

View file

@ -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.