]> code.delx.au - gnu-emacs/commitdiff
Fix recording of events pushed onto unread-command-events
authorEli Zaretskii <eliz@gnu.org>
Mon, 10 Aug 2015 18:15:03 +0000 (21:15 +0300)
committerEli Zaretskii <eliz@gnu.org>
Mon, 10 Aug 2015 18:15:03 +0000 (21:15 +0300)
* 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
<dak@gnu.org>, see
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00193.html.

src/keyboard.c

index e4fe5b9bb4c1519972709d22624fc1b465595c69..f670da3db5ef61b5f2bbc1288bf5067b9ba555fb 100644 (file)
@@ -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: