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

From: JD Smith <[email-masked]>
Date: Fri, 26 Apr 2024 10:37:51 -0400

> On Apr 26, 2024, at 2:06 AM, Juri Linkov <[email-masked]> wrote:
> 
> I feel uneasy about reusing the form (STRING . DEFN)
> that has another meaning:
> 
> a cons (STRING . DEFN), meaning that DEFN is the definition
>    (DEFN should be a valid definition in its own right) and
>    STRING is the menu item name (which is used only if the containing
>    keymap has been created with a menu name, see make-keymap),
> 
> Can the same instead be achieved by using symbol properties?
> For example:

> (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.  Of course a new wrapper macro could also be developed to ease this.  Do you anticipate any specific issues?