[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 9c51a9d: * lisp/repeat.el (repeat-post-hook): Fix key lookup.
From: |
Juri Linkov |
Subject: |
master 9c51a9d: * lisp/repeat.el (repeat-post-hook): Fix key lookup. |
Date: |
Mon, 5 Apr 2021 16:46:59 -0400 (EDT) |
branch: master
commit 9c51a9d00007902232865e6e6265cdd0d7075ae8
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>
* lisp/repeat.el (repeat-post-hook): Fix key lookup.
* lisp/repeat.el (repeat-post-hook): Rename let-bound repeat-map to rep-map.
Define let-bound prefix-command-p. Use lookup-key with
this-single-command-keys instead of last-command-event.
Don't show message when typing prefix keys.
https://lists.gnu.org/archive/html/emacs-devel/2021-04/msg00083.html
---
lisp/repeat.el | 54 +++++++++++++++++++++++++++++-------------------------
1 file changed, 29 insertions(+), 25 deletions(-)
diff --git a/lisp/repeat.el b/lisp/repeat.el
index a2b04b8..a5ab439 100644
--- a/lisp/repeat.el
+++ b/lisp/repeat.el
@@ -364,35 +364,39 @@ When Repeat mode is enabled, and the command symbol has
the property named
(defun repeat-post-hook ()
"Function run after commands to set transient keymap for repeatable keys."
(when repeat-mode
- (let ((repeat-map (and (symbolp this-command)
- (get this-command 'repeat-map))))
- (when repeat-map
- (when (boundp repeat-map)
- (setq repeat-map (symbol-value repeat-map)))
- (let ((map (copy-keymap repeat-map))
- keys mess)
- (map-keymap (lambda (key _) (push key keys)) map)
+ (let ((rep-map (and (symbolp this-command)
+ (get this-command 'repeat-map))))
+ (when rep-map
+ (when (boundp rep-map)
+ (setq rep-map (symbol-value rep-map)))
+ (let ((prefix-command-p (memq this-original-command
+ '(universal-argument
+ universal-argument-more
+ digit-argument
+ negative-argument)))
+ (map (copy-keymap rep-map))
+ keys)
;; Exit when the last char is not among repeatable keys,
;; so e.g. `C-x u u' repeats undo, whereas `C-/ u' doesn't.
- (when (or (memq last-command-event keys)
- (memq this-original-command '(universal-argument
- universal-argument-more
- digit-argument
- negative-argument)))
+ (when (or (lookup-key map (this-single-command-keys) nil)
+ prefix-command-p)
+
;; Messaging
- (setq mess (format-message
- "Repeat with %s%s"
- (mapconcat (lambda (key)
- (key-description (vector key)))
- keys ", ")
- (if repeat-exit-key
- (format ", or exit with %s"
- (key-description repeat-exit-key))
- "")))
- (if (current-message)
- (message "%s [%s]" (current-message) mess)
- (message mess))
+ (unless prefix-command-p
+ (map-keymap (lambda (key _) (push key keys)) map)
+ (let ((mess (format-message
+ "Repeat with %s%s"
+ (mapconcat (lambda (key)
+ (key-description (vector key)))
+ keys ", ")
+ (if repeat-exit-key
+ (format ", or exit with %s"
+ (key-description repeat-exit-key))
+ ""))))
+ (if (current-message)
+ (message "%s [%s]" (current-message) mess)
+ (message mess))))
;; Adding an exit key
(when repeat-exit-key
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 9c51a9d: * lisp/repeat.el (repeat-post-hook): Fix key lookup.,
Juri Linkov <=