3.2. Control and Meta¶
Throughout this chapter, we will use C- to refer to the control key (CTRL) and M- to refer to the meta key. On most systems, ALT or ESC corresponds to M-. On macOS, the Terminal application can be configured to use the OPT (Option) key as M-. If you are using macOS and have not set up OPT to work as meta, then follow the instructions in the macOS Setup Guide.
Modifier Key |
Name |
Usually |
|---|---|---|
C- |
Control |
CTRL |
M- |
Meta |
ESC, ALT, or OPT |
Emacs commands are recognized by their key bindings, which is just a term for keyboard shortcuts. To use Emacs commands effectively, you need to understand how to read their associated key bindings so that you can successfully make the appropriate keystrokes.
3.2.1. Special Keys and Notation¶
In addition to modifier keys, Emacs documentation uses specific notation for special keys:
Notation |
Key on Keyboard |
|---|---|
RET |
Return / Enter |
SPC |
Space bar |
DEL |
Backspace |
TAB |
Tab |
ESC |
Escape |
3.2.2. Reading Keystroke Sequences¶
In the table below, we use KEY(key) to denote that you should
press key while holding KEY, and (key) to denote that key
should be pressed without holding a modifier key.
Command |
Binding |
Keystrokes |
|---|---|---|
Open/Find File |
C-x C-f |
Hold CTRL, press x, press f, release CTRL |
Emacs tutorial |
C-h t |
Hold CTRL, press h, release CTRL, press t |
If a binding has consecutive occurrences of the C- modifier key (such as C-x C-f), there is no need to release CTRL between those keystrokes:
CTRL(x), CTRL(f)(press x with CTRL, release CTRL, then press f with CTRL)CTRL(x, f)(hold CTRL continuously while pressing x then f)
Note
When using ESC as Meta (M-), press and release ESC before pressing the next key. When using ALT or OPT, hold the key down while pressing the next key, just like CTRL.
Rapid Fire Review
What does C- represent?
The Command key
The CTRL key
The META key
The SHIFT key
Sample Solution
b. C- represents the CTRL (Control) key.
Which key typically corresponds to the Meta M- key on most systems?
The SHIFT key
The CTRL key
The ALT, ESC, or OPT key
The Command key
Sample Solution
c. On Linux and Windows systems, ALT or ESC is used. On macOS, OPT (Option) or ESC is used.
What are the corresponding keystrokes to execute the C-x h key binding? Note: This command marks (highlights) all text in the current Emacs buffer.
Hold CTRL, press x, then press h while holding CTRL
Press x, release, then press h while holding CTRL
Hold META, press x, then h
Hold CTRL, press x, release CTRL, then press h
Sample Solution
d. In C-x h, only x has the C- modifier. Hold CTRL, press x, release CTRL, and then press h.