Quick Guide to Emacs

Quick Reference Guide

Quick Guide to Emacs

A collection of commonly used keystrokes and configuration tips for GNU Emacs. Covers navigation, editing, buffers, search, and macros.

Note: This guide was originally published in 2006 and has been updated in May 2026 with corrected key notation, additional sections, and improved formatting, with assistance from Claude (Anthropic).

Key Notation

Emacs key bindings are written in a standard shorthand throughout this guide:

NotationMeaningExample
C-xHold Ctrl and press xC-x C-s means hold Ctrl, press x, then press s
M-xHold Meta (Alt/Esc) and press xOn most keyboards, Meta is the Alt key
C-SPCHold Ctrl and press SpacebarSets the mark for region selection

To run the built-in Emacs tutorial at any time: C-h t

Useful Settings for .emacs

Add these to ~/.emacs or ~/.emacs.d/init.el to configure Emacs on startup:

(line-number-mode 1)       ; show line number in mode line
(column-number-mode 1)     ; show column number in mode line
(display-time)             ; show clock in mode line
(load-theme 'deeper-blue t); set colour theme

To reload your config without restarting: M-x load-file RET ~/.emacs RET

File Operations

ActionKeystroke
Open / find fileC-x C-f
Save fileC-x C-s
Save as (write to new file)C-x C-w
Quit EmacsC-x C-c

Navigation

ActionKeystroke
Go to line numberM-g g
Go to beginning of bufferM-<
Go to end of bufferM->
Move between windowsC-x o
Scroll down / upC-v / M-v

Editing

ActionKeystroke
Set mark (start region selection)C-SPC
Exchange mark and pointC-x C-x
Kill (cut) lineC-k
Yank (paste)C-y
UndoC-/ or C-_
Kill (cut) rectangle regionC-x r k
Yank (paste) rectangle regionC-x r y
Toggle comment on regionM-;

Buffers and Windows

ActionKeystroke
List all open buffersC-x C-b
Switch to bufferC-x b
Kill (close) bufferC-x k
Split window horizontallyC-x 2
Split window verticallyC-x 3
Close current windowC-x 0
Close all other windowsC-x 1

Search and Replace

ActionKeystroke
Incremental search forwardC-s
Incremental search backwardC-r
Query replace (interactive find and replace)M-%
Replace all (no prompt)M-x replace-string

During incremental search, press C-s again to jump to the next match, or RET to exit search at the current position.

Keystroke Macros

Macros let you record a sequence of keystrokes and replay them. Useful for repetitive edits across many lines.

ActionKeystroke
Start recording macroC-x (
Stop recording macroC-x )
Playback last macroC-x e

Useful Packages and Modes

Emacs can be extended with packages. These two are easy to install and immediately useful:

PackageWhat it does
FlyspellOn-the-fly spell checking as you type, similar to spell check in word processors
X-SymbolRenders superscript, subscript and Greek characters visually in LaTeX buffers

Modern Emacs (26+) ships with a built-in package manager. To browse and install packages: M-x package-list-packages. For LaTeX grammar checking, convert your document to HTML first and use an online grammar checker, as LaTeX-native grammar tools are limited.

For the complete built-in reference, use C-h k (describe key) or C-h f (describe function) at any time within Emacs. The official manual is available at gnu.org/software/emacs/manual.