I've read this, but my question is different. I'd like to know how to view key-bindings in Emacs which start with a particular key. I'd like to bind f2
, but would like to know what it's currently bound to. Pressing C-h
m
prompts for the key sequence. Entering f2
here results in Emacs waiting for me to complete the chain, as f2
alone does nothing. How can I view all key-bindings which start with f2
?
F2F1 or F2C-h
In general, typing F1 or C-h after any prefix-binding will list all the bindings using that prefix:
describe-prefix-bindings
is an interactive compiled Lisp function inhelp.el
.Describe the bindings of the prefix used to reach this command. The prefix described consists of all but the last event of the key sequence that ran this command.
F1 is the more reliable of the two (but only very slightly so), as detailed by the following documentation excerpts.
M-: (info "(emacs) Misc Help")
RET:
You can get a list of subcommands for a particular prefix key by typing
C-h
(describe-prefix-bindings
) after the prefix key. (There are a few prefix keys for which this does not work--those that provide their own bindings forC-h
. One of these is<ESC>
, because<ESC> C-h
is actuallyC-M-h
, which marks a defun.)
M-: (info "(emacs) Keys")
RET:
Typing the help character (
C-h
or<F1>
) after a prefix key displays a list of the commands starting with that prefix. The sole exception to this rule is<ESC>
:<ESC> C-h
is equivalent toC-M-h
, which does something else entirely. You can, however, use<F1>
to display a list of commands starting with<ESC>
.
M-: (info "(emacs) Help")
RET:
C-h
or<F1>
means "help" in various other contexts as well. For instance, you can type them after a prefix key to view a list of the keys that can follow the prefix key. (A few prefix keys don't supportC-h
in this way, because they define other meanings for it, but they all support<F1>
for help.)
M-: (info "(elisp) Key Binding Conventions")
RET:
Don't bind
C-h
following any prefix character (includingC-c
).
If you don't bindC-h
, it is automatically available as a help character for listing the subcommands of the prefix character.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With