Subject: bug#60093: 29.0.60; imenu: Variables defined via defvar-keymap are not listed

From: Daniel Mendler <[email-masked]>
Date: Mon, 19 Dec 2022 10:54:27 +0100

On 12/17/22 13:53, Eli Zaretskii wrote:
>> From: Daniel Mendler <[email-masked]>
>> Date: Thu, 15 Dec 2022 15:49:31 +0100
>>
>> Keymaps defined via `defvar-keymap' are not available in the Imenu. It is
>> necessary to extend `imenu-generic-expression'.
> 
> Thanks.  Would you like to suggest a patch to fix this?

I don't have a patch ready. Currently I use the following line in my
configuration which also recognizes Embark keymaps. Would we want to
list keymaps as a separate Imenu category "Keymaps" or as "Variables"?

(add-to-list 'imenu-generic-expression '("Keymaps"
"^[^;]*(\\(?:embark-define-keymap\\|defvar-keymap\\)\\s-+\\(\\(?:\\sw\\|\\s_\\)+\\)"
1) 'append))))