oantolin / embark

Emacs Mini-Buffer Actions Rooted in Keymaps
GNU General Public License v3.0
930 stars 56 forks source link

embark-prefix-help-command hides bindings for menu items #724

Open djr7C4 opened 4 months ago

djr7C4 commented 4 months ago

This occurs for example with some lsp-mode bindings such as lsp-rename. This is bound by default in lsp-command-map to "rr" (lsp-command-map is bound to lsp-keymap-prefix in lsp-mode-map). These show "menu-item" instead of the key binding in embark-prefix-help-command.

In other words, there will be a line when embark-prefix-help-command is run that shows

menu-item    lsp-rename-maybe

when

r r    lsp-rename

is what I would prefer.

The reason is that embark--formatted-bindings contains the code

(concat
 (if (eq (car-safe def) 'menu-item)
     "menu-item"
   (key-description key)))

in the loop that populates the commands variable.

Part of the issue is with embark--command-name which contains

((eq (car-safe cmd) 'menu-item) (eval (cadr cmd)))

in the cond. I have this patched locally and could put together a pull request but I'm not sure what behavior is needed. I personally only care about the key bindings (and not menu items) but perhaps you want to preserve the menu items in embark-prefix-help-command so these should be split into two separate candidates.

bradhowes commented 2 months ago

I think this is also related to an issue I encountered: executing C-x 8 C-h does not show the key translations when prefix-help-command is set to embark-prefix-help-command in my configuration. I am still trying to incorporate Embark into my workflow so this is not a big issue for me, but it did take me some time to figure out where in my configuration I had lost the full output of C-x 8 C-h.