repeat-help icon indicating copy to clipboard operation
repeat-help copied to clipboard

FYI: repeat `:hints` coming

Open jdtsmith opened this issue 1 year ago • 3 comments

Emacs 30 will allow specifying :hints with the repeat maps, so a short bit of text can be displayed with the repeat keys. See bug 70576.

jdtsmith avatar Sep 04 '24 21:09 jdtsmith

Emacs 30 will allow specifying :hints with the repeat maps, so a short bit of text can be displayed with the repeat keys. See bug @.***/).

Thanks for the heads up! I've made a note to add support for it after the RC is out.

karthink avatar Sep 05 '24 00:09 karthink

@jdtsmith I finally got around to this, and it's actually not clear how to incorporate this feature into repeat-help. Is the idea that the repeat-help keymap indicator should show the hint (from :hints) instead of the command name?

karthink avatar Jun 06 '25 20:06 karthink

Cool. It shows the binding and the hint.

`:hints' is a list of cons pairs where car is a command and cdr is a string that is displayed alongside of the repeatable key in the echo area.

What have you tried? Here's an example I just worked up:


(defun my/a ()
  (interactive)
  (insert "A\n"))

(defun my/b ()
  (interactive)
  (insert "B\n"))

(defvar-keymap myab-repeat-map
  :repeat (:hints ((my/a . "More A") (my/b . "More B")))
  "a" 'my/a
  "b" 'my/b)

(progn
  (put 'my/a 'repeat-map 'myab-repeat-map)
  (put 'my/b 'repeat-map 'myab-repeat-map)
  (bind-key "H-a" #'my/a)
  (bind-key "H-b" #'my/b))
Image

If you want to pull the 'repeat-hint property which defvar-keymap sets from the plist of each of your command symbols, you could show those too?

jdtsmith avatar Jun 06 '25 22:06 jdtsmith