Subject: bug#9923: 24.0.91; `where-is' does not find recentf menu items (cmds, not files)

From: Stefan Monnier <[email-masked]>
Date: Wed, 25 Aug 2021 10:49:09 -0400

Lars Ingebrigtsen [2021-08-25 14:18:31] wrote:
> Stefan Monnier <[email-masked]> writes:
>>> The bug is not about the file-name entries in the `Open Recent' menu,
>>> but the menu items that represent commands should show up as bindings
>>> for `C-h w', no?  If not, why not?
>>
>> Indeed, where-is won't find bindings in menus defined with easy-menu and
>> using the :filter thingy.  Hmm...
>
> This problem is still present in Emacs 28.  I tried briefly following
> the logic in where_is_internal and friends, but...
>
> I guess we'd have to check for :filter here, evaluate the filter
> function, and then look up the command in the resulting ... menu
> entries?  Uhm.

Indeed, and evaluating the :filter may not necessarily return the
"right" result (when that result depends on specific conditions of the
time or context when it is run).

So IIRC `where-is` instead uses the "unfiltered" binding.  So you can
often get what you want by being careful about the BINDING you put into
`(menu-item "foo" BINDING :filter ...).

        Stefan