]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix defining keyboard macros in CUA mode
authorEli Zaretskii <eliz@gnu.org>
Wed, 20 Mar 2019 09:21:54 +0000 (11:21 +0200)
committerEli Zaretskii <eliz@gnu.org>
Wed, 20 Mar 2019 09:21:54 +0000 (11:21 +0200)
* lisp/emulation/cua-base.el (cua--prefix-override-replay):
Push the key to replace wrapped in '(no-record . KEY)', so
that it doesn't get recorded more than once.  (Bug#34901)

* src/keyboard.c (read_char): Handle the '(no-record . KEY)'
event by substituting KEY for it.
(syms_of_keyboard) <no-record>: New DEFSYM.
<unread-command-events>: Update the doc string.

* doc/lispref/commands.texi (Event Input Misc): Document the
'(no-record . EVENT)' form.

doc/lispref/commands.texi
lisp/emulation/cua-base.el
src/keyboard.c

index 1eb580e1e0fdd049e93215ccf9fc7a8a3f19854b..cd44c1c87ef0f96c14785da622ecec8e489e5241 100644 (file)
@@ -2880,6 +2880,14 @@ command's key sequence (as returned by, e.g., @code{this-command-keys}),
 as the events will already have been added once as they were read for
 the first time.  An element of the form @w{@code{(t . @var{event})}}
 forces @var{event} to be added to the current command's key sequence.
+
+@cindex not recording input events
+@cindex input events, prevent recording
+Elements read from this list are normally recorded by the
+record-keeping features (@pxref{Recording Input}) and while defining a
+keyboard macro (@pxref{Keyboard Macros}).  However, an element of the
+form @w{@code{(no-record . @var{event})}} causes @var{event} to be
+processed normally without recording it.
 @end defvar
 
 @defun listify-key-sequence key
index 43e0956ea83d95b65b76dbf270281862e759bded..302ef123865d37a9c49c8600624358f0f93bfa40 100644 (file)
@@ -710,7 +710,8 @@ a cons (TYPE . COLOR), then both properties are affected."
     ;; C-x binding after the first C-x C-x was rewritten to just C-x).
     (prefix-command-preserve-state)
     ;; Push the key back on the event queue
-    (setq unread-command-events (cons key unread-command-events))))
+    (setq unread-command-events (cons (cons 'no-record key)
+                                      unread-command-events))))
 
 (defun cua--prefix-override-handler ()
   "Start timer waiting for prefix key to be followed by another key.
index 22e4377ee862f241bea49b1e4718f15d5b060118..362bd663878dd612bb307f5afabb5383d10a4340 100644 (file)
@@ -2364,7 +2364,14 @@ read_char (int commandflag, Lisp_Object map,
       if (CONSP (c) && EQ (XCAR (c), Qt))
        c = XCDR (c);
       else
-       reread = true;
+       {
+         if (CONSP (c) && EQ (XCAR (c), Qno_record))
+           {
+             c = XCDR (c);
+             recorded = true;
+           }
+         reread = true;
+       }
 
       /* Undo what read_char_x_menu_prompt did when it unread
         additional keys returned by Fx_popup_menu.  */
@@ -2745,7 +2752,14 @@ read_char (int commandflag, Lisp_Object map,
       if (CONSP (c) && EQ (XCAR (c), Qt))
        c = XCDR (c);
       else
-       reread = true;
+       {
+         if (CONSP (c) && EQ (XCAR (c), Qno_record))
+           {
+             c = XCDR (c);
+             recorded = true;
+           }
+         reread = true;
+       }
     }
 
   /* Read something from current KBOARD's side queue, if possible.  */
@@ -2807,6 +2821,11 @@ read_char (int commandflag, Lisp_Object map,
 
       if (CONSP (c) && EQ (XCAR (c), Qt))
        c = XCDR (c);
+      else if (CONSP (c) && EQ (XCAR (c), Qno_record))
+       {
+         c = XCDR (c);
+         recorded = true;
+       }
   }
 
  non_reread:
@@ -11193,6 +11212,7 @@ syms_of_keyboard (void)
        Fput (var, Qevent_symbol_elements, list1 (var));
       }
   }
+  DEFSYM (Qno_record, "no-record");
 
   button_down_location = make_nil_vector (5);
   staticpro (&button_down_location);
@@ -11303,7 +11323,9 @@ so that you can determine whether the command was run by mouse or not.  */);
 These events are processed first, before actual keyboard input.
 Events read from this list are not normally added to `this-command-keys',
 as they will already have been added once as they were read for the first time.
-An element of the form (t . EVENT) forces EVENT to be added to that list.  */);
+An element of the form (t . EVENT) forces EVENT to be added to that list.
+An element of the form (no-record . EVENT) means process EVENT, but do not
+record it in the keyboard macros, recent-keys, and the dribble file.  */);
   Vunread_command_events = Qnil;
 
   DEFVAR_LISP ("unread-post-input-method-events", Vunread_post_input_method_events,