Fix defining keyboard macros in CUA mode
* 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.
This commit is contained in:
parent
047c1b1935
commit
f13d97b4de
3 changed files with 35 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue