Skip to content
Tutorials Center
My learning

Topics

Lesson 4 of 38 ยท Getting Started

Key Notation and the Help System

Read Emacs key notation (C-, M-, RET, DEL, prefix keys), fix a missing Meta key, and use C-h k, C-h f, C-h v, C-h m and the info manual to learn the editor.

Every Emacs tutorial, manual page and forum answer writes keys in a compact notation. Once you can read it, all of that documentation is open to you. Then you learn the help commands, which are the real secret: Emacs documents itself, so you rarely need to search the web.

Modifier keys

Written Meaning
C-x Hold Control and press x
M-x Hold Meta (usually Alt, on a Mac Option) and press x
S- Shift
s- Super (the Windows or Command key, depending on setup)
H-, A- Hyper and Alt, rarely used

Keys are combined by writing them one after another, separated by spaces. C-x C-f means: hold Control, press x, then (still holding Control or not) press f. You can keep Control down for both letters. C-x f is a different key sequence (it sets the fill column).

Combined modifiers join with a dash: C-M-f is Control+Meta+f. C-S-backspace is Control+Shift+Backspace.

Special key names

Name Key
RET Enter / Return
TAB Tab
SPC Space bar
DEL The Backspace key (deletes backward)
ESC Escape
<f5>, <up>, <home> Function keys and arrows, shown in angle brackets

Strange but true: terminals cannot tell some control keys apart. C-m is the same as RET, C-i is TAB, and C-[ is ESC. And ESC followed by a key works as M- plus that key, so ESC x is M-x. That fallback helps when no Meta key is available.

When Meta does not work

On macOS the Option key types special characters by default. Add this to your init file, which you create in a later chapter, to make it Meta:

ELISP
(setq mac-option-modifier 'meta)      ; or ns-alternate-modifier on some builds

In some terminals Alt is sent as ESC, which is why ESC x works everywhere. Windows and Linux graphical builds usually need no setup.

Prefix keys and cancelling

Some keys start a sequence: C-x, C-c, C-h, M-g, M-s are prefix keys. After you press one, Emacs waits for the next key and shows the prefix in the echo area. Pausing after a prefix shows a list of possible continuations, which is a useful way to explore.

C-g cancels whatever is happening: a half-typed key sequence, a prompt, a running command. Press it any time you are lost. Press it twice (or three times) if needed.

JS Stand-in: parse Emacs key notation

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The help prefix: C-h

Help commands all start with C-h. The most useful:

Keys Command Answers
C-h k describe-key What does this key do? Press C-h k, then the key.
C-h f describe-function What does this command or function do?
C-h v describe-variable What does this setting mean, and what is its value?
C-h m describe-mode What does the current mode offer?
C-h b describe-bindings Which keys exist right now?
C-h a apropos-command Which commands match a word?
C-h w where-is Which key runs this command?
C-h l view-lossage Which keys did I just press?
C-h e view-echo-area-messages Open the *Messages* log
C-h i info Open the Info manuals
C-h t help-with-tutorial The interactive tutorial
C-h ? help-for-help A menu of all help commands

A help buffer for a function shows its docstring, key bindings, the file it is defined in (with a link you can follow by pressing RET), and how it can be called. Follow cross-references with TAB and RET, go back with l, and close the window with q.

Typical help workflow

Suppose you press C-t by accident and two letters swap. To find out why: press C-h k C-t and Emacs says it runs transpose-chars. To learn more commands about transposing: C-h a transpose RET. To see the keys bound in your current mode: C-h m.

Info manuals

Emacs ships with complete manuals in the Info reader: the Emacs manual, the Emacs Lisp manual, the Org manual and more. Open the list with C-h i. Navigation keys inside Info: SPC and DEL scroll, n/p go to the next/previous node, u goes up, l goes back, m opens a menu item, s searches, q quits. C-h r jumps straight to the Emacs manual. The manual's chapter on a command is also reachable from a function help buffer.

Why this matters

Because key bindings can be changed, the key you read in a tutorial may not be the one on your machine. C-h k tells the truth about your Emacs. Likewise, C-h v shows the current value of any setting and lets you customize it. This habit turns Emacs from a pile of shortcuts to learn into a system you can interrogate.

JS Stand-in: a tiny key-to-command table with describe-key

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. What does C-x C-f mean?

    A space separates keys in a sequence; C- means Control is held for that key.
  2. 2. How do you find out what a key does in your own Emacs?

    C-h k (describe-key) reports the command bound to the next key you press.
  3. 3. What does ESC x do?

    ESC followed by a key acts as the Meta version of that key.
  4. 4. Which key cancels a half-typed command?

    C-g is the universal quit key.
  5. 5. What is DEL in Emacs key notation?

    DEL means the key that deletes backward, which is Backspace.

Summary

  • C- is Control, M- is Meta (Alt or Option, or ESC then the key), and keys in a sequence are separated by spaces.
  • RET, TAB, SPC, DEL and ESC name special keys; C-g cancels.
  • Prefix keys like C-x and C-h wait for another key.
  • C-h k, C-h f, C-h v, C-h m, C-h a and C-h i let Emacs explain itself; use them before searching the web.

Next: Moving the Cursor