Keys and notation
First, we need to get used to special notation Emacs uses to describe key combinations. This notation is used everywhere: in the interface itself, in the manual, books, articles, tutorials, etc. We will use it in this course as well.
Modifier keys:
Control
is shortened toC
.Alt
(Option
on mac) is calledMeta
and shortened toM
.
Simple combinations:
- When a key must be pressed with a modifier, they are written with a dash. E.g.
C-g
is "hold Control and press g, then release both". - When a key must be pressed after releasing another key(s), they are written with a space. E.g.
C-h k
is "hold Control and press h, then release both and press k".
A little bit about those two examples:
C-g
is a "cancel" command which, depending on context, stops the process or a ongoing key combination. You'll use it very often. Semantically, C-g
is similar to Escape in modern apps.
C-h k
is a part of the help system. It's is very useful for exploring the meaning of key combinations. When it's engaged, you can press any key or key combination, and Emacs will open its description. Perform this combination now and you'll see a message in the minibuffer, the line near the bottom of the window. There's also a cursor there, which means Emacs is expecting you to do something. Press C-g
and you should see a help page about the function keyboard-quit
which is bound to C-g
.
The help appeared as an additional panel below (or besides, depending on your screen size) the initial file. The minibuffer message now says "Type C-x 1 to delete the help window". Do that now and you should get back to the initial state. Just to remind you: C-x 1
means "hold Control and press x, then release both and press 1".
A side note on weird symbols: Sometimes key combinations include @
or &
or any other symbol which isn't usually present on the keyboard by itself. For example, C-c @
runs the Org mode command org-mark-subtree
, which selects all the text in the current subtree (section). I used it just a moment ago to select this chapter of the course and copy-paste it elsewhere. Technically, I pressed Control-c Shift-2
, because @
can only be reached with a shift on my keyboard. Emacs doesn't care what you do to enter that symbol, and the description of the combination does not include the manner in which you produce the key.
Among other things, weird keys made it somewhat confusing to learn Emacs in the beginning for me. It's not that they're necessarily difficult or long. It's that there are so, so many of them, and the majority feel absolutely random. As I learned more, I realized two good things:
- Most of keys used in Emacs aren't actually random, but have a semantic connection. I'll do my best to highlight them throughout the course.
- Since everything is customizable, you're free to change any key combination to any other. This has pros and cons, and I will talk about them as I propose customizations.