all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] ; Do not overwrite prexisting contents of unread-command-events
@ 2015-07-25 16:57 David Kastrup
  2015-07-25 17:07 ` David Kastrup
  0 siblings, 1 reply; 5+ messages in thread
From: David Kastrup @ 2015-07-25 16:57 UTC (permalink / raw)
  To: emacs-devel; +Cc: David Kastrup

---
 lisp/comint.el               |  5 +++--
 lisp/double.el               |  8 +++++---
 lisp/ebuff-menu.el           |  6 ++++--
 lisp/ehelp.el                |  8 ++++----
 lisp/eshell/em-hist.el       |  2 +-
 lisp/gnus/gnus-art.el        | 24 ++++++++++++++----------
 lisp/info.el                 |  2 +-
 lisp/international/quail.el  |  6 ++++--
 lisp/international/robin.el  |  2 +-
 lisp/kmacro.el               |  2 +-
 lisp/language/hanja-util.el  |  4 +++-
 lisp/leim/quail/hangul.el    | 12 +++++++++---
 lisp/leim/quail/japanese.el  |  7 ++++---
 lisp/leim/quail/lao.el       |  5 +++--
 lisp/leim/quail/lrt.el       |  5 +++--
 lisp/leim/quail/tibetan.el   | 10 ++++++----
 lisp/obsolete/terminal.el    |  4 +++-
 lisp/obsolete/vip.el         |  7 ++++---
 lisp/pcomplete.el            |  2 +-
 lisp/progmodes/cperl-mode.el |  4 ++--
 lisp/progmodes/ebrowse.el    |  3 ++-
 lisp/progmodes/fortran.el    |  2 +-
 lisp/progmodes/octave.el     |  2 +-
 lisp/progmodes/vhdl-mode.el  | 17 +++++++++--------
 lisp/simple.el               |  6 ++++--
 lisp/subr.el                 |  3 ++-
 lisp/term.el                 |  6 ++++--
 lisp/vc/emerge.el            |  2 +-
 28 files changed, 100 insertions(+), 66 deletions(-)

diff --git a/lisp/comint.el b/lisp/comint.el
index de22061..7db297a 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)))))))
 \f
 (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 b06f59c..ee511e5 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 337ea10..9341806 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 66e4f5c..2e15af3 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 1cdf6d6..9f070c3 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 d83eadd..ffe9a21 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 48d9d19..0a2206d 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 90a540a..f60af4a 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 8254180..0ef90b1 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 327cf45..9636a36 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 8b62ee7..c9501d2 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 12d7358..56a244f 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 fd6628b..831725f 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 52357af..14cf926 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 342b52d..ed9138d 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 1313f56..5dacf29 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 6bab61b..f1a38d2 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 d6adbd4..0c345e2 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 7bcf2c1..90f0695 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 7d2f3fc..826b3ee 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 f91e4a7..8d7c8aa 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 65aa745..83e427d 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 50f888c..89e0b10 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 5ed0ff0..5b4b06c 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 7eed279..ed71888 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 e2c1bae..2295ab8 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))))
 
 \f
diff --git a/lisp/term.el b/lisp/term.el
index 4c82986..06a44f2 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 b17d11d..de25cba 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.
-- 
2.1.4




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] ; Do not overwrite prexisting contents of unread-command-events
  2015-07-25 16:57 [PATCH] ; Do not overwrite prexisting contents of unread-command-events David Kastrup
@ 2015-07-25 17:07 ` David Kastrup
  2015-08-03 14:58   ` David Kastrup
  0 siblings, 1 reply; 5+ messages in thread
From: David Kastrup @ 2015-07-25 17:07 UTC (permalink / raw)
  To: emacs-devel


Unfortunately, recording macros with C-x ( ... C-x ) and replaying with
C-x e is still bleeding probably something like 15% of my events
synthesized from Midi when pressing chord buttons on an accordion
(3 immediately adjacent Midi events taking something like 2 bytes each
at 31250 bits/s, read in via an Emacs process filter function).

So the output of C-x e is somewhat shorter than the equivalent when
recording.

I suspect that code of the form

(let (unread-command-events)
   ...
 )

in the macro recording is at fault by letting material arrive in a
let-bound unread-command-events and not taking all of it out before
unbinding.

But at least most of the other opportunities for dropping
events/characters are addressed by this patch.

-- 
David Kastrup



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ; Do not overwrite prexisting contents of unread-command-events
  2015-07-25 17:07 ` David Kastrup
@ 2015-08-03 14:58   ` David Kastrup
  2015-08-03 15:15     ` Artur Malabarba
  0 siblings, 1 reply; 5+ messages in thread
From: David Kastrup @ 2015-08-03 14:58 UTC (permalink / raw)
  To: emacs-devel

David Kastrup <dak@gnu.org> writes:

> Unfortunately, recording macros with C-x ( ... C-x ) and replaying with
> C-x e is still bleeding probably something like 15% of my events
> synthesized from Midi when pressing chord buttons on an accordion
> (3 immediately adjacent Midi events taking something like 2 bytes each
> at 31250 bits/s, read in via an Emacs process filter function).
>
> So the output of C-x e is somewhat shorter than the equivalent when
> recording.
>
> I suspect that code of the form
>
> (let (unread-command-events)
>    ...
>  )
>
> in the macro recording is at fault by letting material arrive in a
> let-bound unread-command-events and not taking all of it out before
> unbinding.
>
> But at least most of the other opportunities for dropping
> events/characters are addressed by this patch.

Barring any comments, I am going to push this patch to master, probably
by tomorrow.  It does not fix the main lossage of events pushed into
unread-command-events (which is likely the fault of some code in
src/keyboard.c and also keeps the events from appearing in a dribble
file even though their keymap actions are executed).  But it reduces the
amount of stuff one has to worry about.

-- 
David Kastrup



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ; Do not overwrite prexisting contents of unread-command-events
  2015-08-03 14:58   ` David Kastrup
@ 2015-08-03 15:15     ` Artur Malabarba
  2015-08-03 16:36       ` David Kastrup
  0 siblings, 1 reply; 5+ messages in thread
From: Artur Malabarba @ 2015-08-03 15:15 UTC (permalink / raw)
  To: David Kastrup; +Cc: emacs-devel

I've noticed recently that while executing keyboard macros with C-x e,
if I hold down the e key I'll get some e's inserted in between some of
the macro executions. Could this be related to the same issue?



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ; Do not overwrite prexisting contents of unread-command-events
  2015-08-03 15:15     ` Artur Malabarba
@ 2015-08-03 16:36       ` David Kastrup
  0 siblings, 0 replies; 5+ messages in thread
From: David Kastrup @ 2015-08-03 16:36 UTC (permalink / raw)
  To: Artur Malabarba; +Cc: emacs-devel

Artur Malabarba <bruce.connor.am@gmail.com> writes:

> I've noticed recently that while executing keyboard macros with C-x e,
> if I hold down the e key I'll get some e's inserted in between some of
> the macro executions. Could this be related to the same issue?

Could well be related to the main problem I am having (namely that
events get executed but manage to bypass recording).  This patch here,
however, is against losing events altogether.  So it is not likely to
make much of a difference.  If at all, it might slightly increase your
quota of inserted e letters just because it increases the likelihood
that unread-command-events accumulates more than a single event.

-- 
David Kastrup



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-08-03 16:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-25 16:57 [PATCH] ; Do not overwrite prexisting contents of unread-command-events David Kastrup
2015-07-25 17:07 ` David Kastrup
2015-08-03 14:58   ` David Kastrup
2015-08-03 15:15     ` Artur Malabarba
2015-08-03 16:36       ` David Kastrup

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.