Subject: bug#70576: [PATCH] `repeat-echo-message-string': support repeat keymap "hints"

From: Juri Linkov <[email-masked]>
Date: Sun, 28 Apr 2024 09:58:10 +0300

>> (defvar-keymap expreg-repeat-map
>>    :doc "Repeat map for `expreg' actions."
>>    :repeat t
>>    "\\" 'expreg-expand
>>    "|"  'expreg-contract)
>>
>> (put 'expreg-expand 'repeat-hint "expand")
>> (put 'expreg-contract 'repeat-hint "contract")
>
> Thanks for taking a look.  A property on the command could work (and then
> you need no :name).  It would be somewhat harder to maintain the structure
> for long keymaps, e.g. if a command changes.  I do note that menu-item with
> :filter is commonly recommended for non-menu dynamic bindings, so there is
> some precedent of reusing menu functionality in other contexts.

As a more complicated feature, usually :filter is added by developers for
specific functionality, it's not intended to be used by users in their normal
customization of keymaps, like users will configure hints.

> Of course a new wrapper macro could also be developed to ease this.
> Do you anticipate any specific issues?

Here is what I recommend to do to simplify the definition of hints for users.

Like there can be a list of enter and exit commands in 'defvar-keymap':

  :repeat ‘(:enter (commands ...) :exit (commands ...))’

the same list could be used for hints:

  :repeat ‘(:enter (commands ...) :exit (commands ...) :hints ((command . hint) ...))’

This should be easier to document and to understand by users than
a special syntax of cons for binding and the requirement to add :name.