From 30a6b1f81412044aa7dda5573b0142a0a03c4fd3 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 10 Aug 2015 21:15:03 +0300 Subject: [PATCH] Fix recording of events pushed onto unread-command-events * src/keyboard.c (read_char): Make sure events read from unread-command-events and unread-post-input-method-events are always recorded by record_char. Reported by David Kastrup , see http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00193.html. --- src/keyboard.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/keyboard.c b/src/keyboard.c index e4fe5b9bb4c..f670da3db5e 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -2387,7 +2387,7 @@ read_char (int commandflag, Lisp_Object map, Lisp_Object tem, save; volatile Lisp_Object previous_echo_area_message; volatile Lisp_Object also_record; - volatile bool reread; + volatile bool reread, recorded; struct gcpro gcpro1, gcpro2; bool volatile polling_stopped_here = 0; struct kboard *orig_kboard = current_kboard; @@ -2405,6 +2405,8 @@ read_char (int commandflag, Lisp_Object map, retry: + recorded = false; + if (CONSP (Vunread_post_input_method_events)) { c = XCAR (Vunread_post_input_method_events); @@ -2994,6 +2996,7 @@ read_char (int commandflag, Lisp_Object map, /* Store these characters into recent_keys, the dribble file if any, and the keyboard macro being defined, if any. */ record_char (c); + recorded = true; if (! NILP (also_record)) record_char (also_record); @@ -3129,6 +3132,14 @@ read_char (int commandflag, Lisp_Object map, Vunread_post_input_method_events = nconc2 (XCDR (tem), Vunread_post_input_method_events); } + /* When we consume events from the various unread-*-events lists, we + bypass the code that records input, so record these events now if + they were not recorded already. */ + if (!recorded) + { + record_char (c); + recorded = true; + } reread_first: -- 2.39.2