help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Get key-binding for a command and print key binding in kbd syntax


From: Tassilo Horn
Subject: Get key-binding for a command and print key binding in kbd syntax
Date: Thu, 09 Feb 2023 09:33:16 +0100
User-agent: mu4e 1.9.19; emacs 30.0.50

Hi all,

someone asked on another list if mu4e could replace its main buffer's
content, parts of which looks like

  Maildirs

        * [ji] /Fastmail/GNU                                 0/1244
        * [ja] /Fastmail/Archive                             0/8976
        * [jb] /Fastmail/Drafts                              0/24

where j is the key bound to the mu4e-search-maildir command by default,
with the correct key bound in its mode's map.  I.e., right now, j is
hard-coded and conforms to the standard binding but is wrong when you
define-key it otherwise.

So the question is: how do you get the key(s) for a command?
`where-is-internal' looks promising giving ([106] [menu-bar mu4e Search\
maildir]) where 106 is the char ?j.  If that's the right way, is numeric
vector vs. vector of symbols the right way to distinguish key bindings
from menu items?

And the other question: how to I convert such a key binding vector to a
string in kbd syntax for display purposes?

Thanks,
Tassilo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]