[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master f13d97b: Fix defining keyboard macros in CUA mode
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] master f13d97b: Fix defining keyboard macros in CUA mode |
Date: |
Wed, 20 Mar 2019 05:23:14 -0400 (EDT) |
branch: master
commit f13d97b4de02586cce49909aa2f3f51fcb5daa5f
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>
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.
---
doc/lispref/commands.texi | 8 ++++++++
lisp/emulation/cua-base.el | 3 ++-
src/keyboard.c | 28 +++++++++++++++++++++++++---
3 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi
index 1eb580e..cd44c1c 100644
--- a/doc/lispref/commands.texi
+++ b/doc/lispref/commands.texi
@@ -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 @address@hidden(t . @var{event})}}
forces @var{event} to be added to the current command's key sequence.
+
address@hidden not recording input events
address@hidden 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 @address@hidden(no-record . @var{event})}} causes @var{event} to be
+processed normally without recording it.
@end defvar
@defun listify-key-sequence key
diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el
index 43e0956..302ef12 100644
--- a/lisp/emulation/cua-base.el
+++ b/lisp/emulation/cua-base.el
@@ -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.
diff --git a/src/keyboard.c b/src/keyboard.c
index 22e4377..362bd66 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -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,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master f13d97b: Fix defining keyboard macros in CUA mode,
Eli Zaretskii <=