1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 14:30:50 -08:00

Improve repeat-mode to correctly show multi-key sequences as echo

* lisp/repeat.el (repeat-echo-message-string):
Use 'cl--map-keymap-recursively' that iterates over
complete key sequences.  Also it returns key vectors,
so don't need to use 'vector'.
This commit is contained in:
Juri Linkov 2025-01-14 21:48:53 +02:00
parent 0bd12f560b
commit 2e937dc2b5

View file

@ -566,8 +566,9 @@ This function can be used to force exit of repetition while it's active."
(defun repeat-echo-message-string (keymap) (defun repeat-echo-message-string (keymap)
"Return a string with the list of repeating keys in KEYMAP." "Return a string with the list of repeating keys in KEYMAP."
(let (keys) (let (keys)
(map-keymap (lambda (key cmd) (and cmd (push (cons key cmd) keys))) (cl--map-keymap-recursively
keymap) (lambda (key cmd) (and cmd (push (cons (copy-sequence key) cmd) keys)))
keymap)
(format-message (format-message
"Repeat with %s%s" "Repeat with %s%s"
(mapconcat (lambda (key-cmd) (mapconcat (lambda (key-cmd)
@ -577,7 +578,7 @@ This function can be used to force exit of repetition while it's active."
(get cmd 'repeat-hint)))) (get cmd 'repeat-hint))))
;; Reuse `read-multiple-choice' formatting. ;; Reuse `read-multiple-choice' formatting.
(cdr (rmc--add-key-description (list key hint))) (cdr (rmc--add-key-description (list key hint)))
(propertize (key-description (vector key)) (propertize (key-description key)
'face 'read-multiple-choice-face)))) 'face 'read-multiple-choice-face))))
keys ", ") keys ", ")
(if repeat-exit-key (if repeat-exit-key