Given an emacs command name, how would you find key-bindings ? (and vice versa)


If I know an emacs command name, says, "goto-line"; what if I want to query whether if there are any key-sequences bound to this command ?

And vice versa, given a key sequence, how can I find its command name ?

Best Solution

To just find key bindings for a command, you can use emacs help's "where-is" feature

C-h w command-name

If multiple bindings are set for the command they will all be listed.

For the inverse, given a key sequence, you can type

C-h k key-sequence

To get the command that would run.

You can get detailed information about a command, also any non-interactive function defined, by typing

C-h f function-name

Which will give you detailed information about a function, including any key bindings for it, and

C-h v variable-name

will give you information about any (bound) variable. Key-maps are kept in variables, however the key codes are stored in a raw format. Try C-h v isearch-mode-map for an example.

For more help on getting help, you can type

C-h ?
Related Question