mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Fix repeat-echo-message-string for keys with hints (bug#78797).
* lisp/repeat.el (repeat-echo-message-string): For one character use it to format hints. For multi-key sequence first print it, then use the last character to format hints in parenthesis. * test/lisp/repeat-tests.el (repeat-tests-another-repeat-map): Add hints. (repeat-tests-hints): Add test.
This commit is contained in:
parent
564a8da53e
commit
e5646f7903
2 changed files with 27 additions and 5 deletions
|
|
@ -586,9 +586,16 @@ This function can be used to force exit of repetition while it's active."
|
|||
(let ((key (car key-cmd))
|
||||
(cmd (cdr key-cmd)))
|
||||
(if-let* ((hint (and (symbolp cmd)
|
||||
(get cmd 'repeat-hint))))
|
||||
(get cmd 'repeat-hint)))
|
||||
(last (aref key (1- (length key)))))
|
||||
;; Reuse `read-multiple-choice' formatting.
|
||||
(cdr (rmc--add-key-description (list key hint)))
|
||||
(if (= (length key) 1)
|
||||
(cdr (rmc--add-key-description (list last hint)))
|
||||
(format "%s (%s)"
|
||||
(propertize (key-description key)
|
||||
'face 'read-multiple-choice-face)
|
||||
(cdr (rmc--add-key-description
|
||||
(list (event-basic-type last) hint)))))
|
||||
(propertize (key-description key)
|
||||
'face 'read-multiple-choice-face))))
|
||||
keys ", ")
|
||||
|
|
|
|||
|
|
@ -93,7 +93,9 @@
|
|||
:repeat ( :enter (repeat-tests-call-s)
|
||||
:continue (repeat-tests-call-e
|
||||
repeat-tests-call-o
|
||||
repeat-tests-call-u))
|
||||
repeat-tests-call-u)
|
||||
:hints ((repeat-tests-call-t . "test")
|
||||
(repeat-tests-call-o . "another test")))
|
||||
"s" 'ignore ;; for non-nil repeat-check-key only
|
||||
"t" 'repeat-tests-call-t
|
||||
"C-M-o" 'repeat-tests-call-o
|
||||
|
|
@ -238,8 +240,7 @@
|
|||
;; 'C-M-o' should also activate
|
||||
(repeat-tests--check
|
||||
"C-M-o c z"
|
||||
'((1 o) (1 c)) "z")
|
||||
)))
|
||||
'((1 o) (1 c)) "z"))))
|
||||
|
||||
(ert-deftest repeat-tests-continue-another ()
|
||||
(with-repeat-mode repeat-tests-global-map
|
||||
|
|
@ -269,6 +270,20 @@
|
|||
"C-M-a c C-M-o C-M-o c z"
|
||||
'((1 a) (1 c) (1 o) (1 o) (1 c)) "z"))))
|
||||
|
||||
(ert-deftest repeat-tests-hints ()
|
||||
(with-repeat-mode repeat-tests-global-map
|
||||
(let ((repeat-echo-function 'ignore)
|
||||
(repeat-check-key nil))
|
||||
(execute-kbd-macro (kbd "C-M-s"))
|
||||
(should (equal (repeat-echo-message-string (repeat-get-map repeat-in-progress))
|
||||
#("Repeat with s, [T]est, C-M-o (an[O]ther test), C-M-u"
|
||||
12 13
|
||||
(face read-multiple-choice-face)
|
||||
23 28
|
||||
(face read-multiple-choice-face)
|
||||
47 52
|
||||
(face read-multiple-choice-face)))))))
|
||||
|
||||
|
||||
(require 'use-package)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue