Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get a list of commands starting with a certain key (combo) in Emacs?

I can use C-h c (describe-key-briefly) and type a key combination and it will return me the function bound to it. But I'd also like to type only a prefix of a key combination and have it list and describe all functions bound to key sequences starting with it, like "all bound keys starting with C-x".

like image 710
agentofuser Avatar asked Aug 15 '09 15:08

agentofuser


People also ask

How do I set key bindings in Emacs?

The manual way is to use C-h k KEY to describe what KEY is bound to; the other way is to describe a function, FUNCTION , with C-h f FUNCTION . Because Emacs is a self-documenting editor all functions, variables, keys, etc. known to Emacs are accessible through the describe-xxx commands. Type C-h C-h to see them all.

What does M in EMAC stand for?

The M stands for the Meta key, which you can emulate on most keyboards by pressing the Esc key. For more information on Emacs keystroke naming conventions, see How keystrokes are denoted in Emacs. The default function of M-x is the command execute-extended-command .

How do I use MX in Emacs?

To invoke a command by its full name, type M-x , then the name of the command, and finally hit RETURN (notice that all this happens in the echo area). You can hit RETURN even before entering the whole command name, provided there is only one "immediate" completion.

What does CX do in Emacs?

Quit emacs (Note: C-x means to press the control key and while you are holding it down, press x. Other places use the notation ^X or ctrl-X.) You can use the arrow keys and also page up and page down to move the cursor.


2 Answers

Do the key combo then C-h. For your example of C-x, do C-x C-h. This also works with sub-maps, e.g. C-x r C-h to see everything under C-x r

like image 189
scottfrazer Avatar answered Oct 18 '22 21:10

scottfrazer


It is also not the case that every prefix key works this way (follow it with C-h to see the bindings).

Here are two additional resources that can help:

  • Command describe-keymap, in help-fns+.el. But to use it you need to have the keymap available (e.g. as the value of a variable, such as ctl-x-map). Unlike just using C-h v on a keymap variable, the output is human readable.

  • Icicles key completion. Just type the prefix key, then hit S-TAB. Buffer *Completions* shows you all possible completions: the keys plus their associated commands (or ... if they are themselves prefix keys). For multiple-level prefix keys (e.g. C-x r) the candidates include prefix keys (e.g. prefix key r to partially complete prefix key C-x). You can navigate up and down the keymap hierarchy this way. And you can cycle among candidates and hit C-M-RET on any to see their complete help.

like image 21
Drew Avatar answered Oct 18 '22 21:10

Drew