Subject: bug#78797: 31.0.50; hints in a repeat map cause an error

From: Juri Linkov <[email-masked]>
Date: Sun, 15 Jun 2025 19:49:07 +0300

> Using the following minimal configuration:
>
> (repeat-mode +1)

Thanks for the bug report.

> (defvar-keymap navigation-repeat-map
>   :repeat (:hints ((next-line . "next")
>                    (previous-line . "previous")))
>   "n" #'next-line
>   "p" #'previous-line)
>
> Attempting to press "n" or "p" results in an error on Emacs master:
> "Error in post-command-hook (repeat-post-hook): wrong-type-argument
> characterp [110])"

I guess you meant pressing "C-n" or "C-p", then it's reproducible.

> The repetition does not seem to work as well. The same configuration
> works correctly on Emacs 30.1. The commit that introduced this behavior
> seems to be 2e937dc2b5ad7a87a099df3f014795e88df5cba9 and it may be
> reproduced just by calling repeat-echo-message-string function.

This commit fixed the display of keys with modifiers.
For example, for

(defvar-keymap navigation-repeat-map
  :repeat t
  "M-n" #'next-line
  "M-p" #'previous-line)

it displayed just "Repeat with ESC", but after this commit
correctly displays "Repeat with M-n, M-p".

So we need to decide how to display hints for keys with modifiers.

Without modifiers, it displays "Repeat with *n*ext, *p*revious".
Maybe with modifiers it could display "Repeat with M-*n*ext, M-*p*revious".
But what if the character is in the middle of the hint?

For example, for the hint "foonext" it will display "M-foo*n*ext".
This looks strange.