0% found this document useful (0 votes)
50 views

Notes To The Emacs Manual: Johannes Choo

This document contains notes for the Emacs manual. It is divided into four major sections that cover important general concepts, fundamental editing commands, important text-changing commands, and major structures of Emacs such as file handling. The sections and subsections are outlined with titles and punctuation rules to indicate their structure and hierarchy.

Uploaded by

Johannes Choo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views

Notes To The Emacs Manual: Johannes Choo

This document contains notes for the Emacs manual. It is divided into four major sections that cover important general concepts, fundamental editing commands, important text-changing commands, and major structures of Emacs such as file handling. The sections and subsections are outlined with titles and punctuation rules to indicate their structure and hierarchy.

Uploaded by

Johannes Choo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

Notes to the Emacs Manual

Johannes Choo

i
Contents
Contents ii

I Important General Concepts 1

1 The Organization of the Screen 2

2 Kinds of User Input 2

3 Keys 2

4 Keys and Commands 2

5 Entering Emacs 2

6 Exiting Emacs 2

II Fundamental Editing Commands 4

7 Basic Editing Commands 5


7.1 Inserting Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
7.2 Changing the Location of Point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
7.3 Erasing Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
7.4 Undoing Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
7.5 Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
7.6 Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
7.7 Blank Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
7.8 Continuation Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
7.9 Cursor Position Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
7.10 Numeric Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
7.11 Repeating a Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

8 The Minibuffer 7

9 Running Commands by Name 7

10 Help 7

III Important Text-Changing Commands 8

11 The Mark and the Region 9


11.1 Setting the Mark . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

ii
11.2 Commands to Mark Textual Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
11.3 Operating on the Region . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
11.4 The Mark Ring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
11.5 The Global Mark Ring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
11.6 Shift Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
11.7 Disabling Transient Mark Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

12 Killing and Moving Text 10


12.1 Deletion and Killing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
12.2 Yanking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
12.3 Cut and Paste Operations on Graphical Displays . . . . . . . . . . . . . . . . . . . . . 12
12.4 Accumulating Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
12.5 Rectangles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
12.6 CUA Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

13 Registers 13

14 Controlling the Display 13

15 Searching and Replacement 13

16 Commands for Fixing Typos 13

17 Keyboard Macros 13

IV Major Structures of Emacs 14

18 File Handling 15
18.1 File Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
18.2 Visiting Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
18.3 Saving Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
18.4 Reverting a Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
18.5 Auto Reverting Non-File Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
18.6 Auto-Saving: Protection Against Disasters . . . . . . . . . . . . . . . . . . . . . . . . . . 16
18.7 File Name Aliases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
18.8 File Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
18.9 Comparing Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
18.10Diff Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
18.11Miscellaneous File Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
18.12Accessing Compressed Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
18.13File Archives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
18.14Remote Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
18.15Quoted File Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
18.16File Name Cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
18.17Convenience Features for Finding Files . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
18.18Filesets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

19 Using Multiple Buffers 17

20 Multiple Windows 17

iii
21 Frames and Graphical Displays 17

22 International Character Set Support 17

V Advanced Features 18

23 Major and Minor Modes 19


23.1 Major Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
23.2 Minor Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
23.3 Choosing File Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

24 Indentation 20

25 Commands for Human Languages 20


25.1 Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
25.2 Sentences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
25.3 Paragraphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
25.4 Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
25.5 Quotation Marks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
25.6 Filling Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
25.7 Case Conversion Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
25.8 Text Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
25.9 Outline Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
25.10Org Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
25.11TeX Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
25.12SGML and HTML Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
25.13Nroff Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
25.14Enriched Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
25.15Editing Text-based Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
25.16Two-Column Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

26 Editing Programs 21

27 Compiling and Testing Programs 21


27.1 Running Compilations under Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
27.2 Compilation Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
27.3 Subshells for Compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
27.4 Searching with Grep under Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
27.5 Finding Syntax Errors on the Fly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
27.6 Running Debuggers Under Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
27.7 Executing Lisp Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
27.8 Libraries of Lisp Code for Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
27.9 Evaluating Emacs Lisp Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
27.10Lisp Interaction Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
27.11Running an External Lisp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

28 Maintaining Large Programs 22


28.1 Version Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
28.2 Change Logs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
28.3 Find Identifier References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

iv
28.4 Emacs Development Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
28.5 Merging Files with Emerge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

29 Abbrevs 25

30 Dired, the Directory Editor 25


30.1 Entering Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
30.2 Navigation in the Dired Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
30.3 Deleting Files with Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
30.4 Flagging Many Files at Once . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
30.5 Visiting Files in Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
30.6 Dired Marks vs. Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
30.7 Operating on Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
30.8 Shell Commands in Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
30.9 Transforming File Names in Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
30.10File Comparison with Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
30.11Subdirectories in Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
30.12Subdirectory Switches in Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
30.13Moving Over Subdirectories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
30.14Hiding Subdirectories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
30.15Updating the Dired Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
30.16Dired and Find . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
30.17Editing the Dired Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
30.18Viewing Image Thumbnails in Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
30.19Other Dired Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

VI Recovery from Problems 27

VIIAppendices 28

Indexes 29

v
List of Corrections Note: TODO . . . . . . . . . . . . . . . . . . 21
Note: TODO . . . . . . . . . . . . . . . . . . 23
Note: TODO . . . . . . . . . . . . . . . . . . 5 Note: TODO . . . . . . . . . . . . . . . . . . 23
Note: TODO: invoked twice . . . . . . . . . 5 Note: TODO . . . . . . . . . . . . . . . . . . 24
Note: TODO . . . . . . . . . . . . . . . . . . 6 Note: TODO . . . . . . . . . . . . . . . . . . 24
Note: TODO . . . . . . . . . . . . . . . . . . 7 Note: TODO . . . . . . . . . . . . . . . . . . 24
Note: TODO . . . . . . . . . . . . . . . . . . 7 Note: TODO . . . . . . . . . . . . . . . . . . 24
Note: TODO . . . . . . . . . . . . . . . . . . 7 Note: TODO . . . . . . . . . . . . . . . . . . 24
Note: TODO . . . . . . . . . . . . . . . . . . 7 Note: TODO . . . . . . . . . . . . . . . . . . 25
Note: TODO . . . . . . . . . . . . . . . . . . 9 Note: TODO . . . . . . . . . . . . . . . . . . 25
Note: TODO . . . . . . . . . . . . . . . . . . 9 Note: TODO . . . . . . . . . . . . . . . . . . 25
Note: TODO: clarify . . . . . . . . . . . . . 11 Note: TODO . . . . . . . . . . . . . . . . . . 26
Note: TODO . . . . . . . . . . . . . . . . . . 12 Note: TODO . . . . . . . . . . . . . . . . . . 26
Note: TODO . . . . . . . . . . . . . . . . . . 12
Note: TODO . . . . . . . . . . . . . . . . . . 12
Note: TODO . . . . . . . . . . . . . . . . . . 13
Note: TODO . . . . . . . . . . . . . . . . . . 13
Note: TODO . . . . . . . . . . . . . . . . . . 13
Note: TODO . . . . . . . . . . . . . . . . . . 13
Note: TODO . . . . . . . . . . . . . . . . . . 13
Note: TODO . . . . . . . . . . . . . . . . . . 15
Note: TODO . . . . . . . . . . . . . . . . . . 15
Note: TODO . . . . . . . . . . . . . . . . . . 15
Note: TODO . . . . . . . . . . . . . . . . . . 16
Note: TODO . . . . . . . . . . . . . . . . . . 16
Note: TODO . . . . . . . . . . . . . . . . . . 16
Note: TODO . . . . . . . . . . . . . . . . . . 16
Note: TODO . . . . . . . . . . . . . . . . . . 16
Note: TODO . . . . . . . . . . . . . . . . . . 16
Note: TODO . . . . . . . . . . . . . . . . . . 16
Note: TODO . . . . . . . . . . . . . . . . . . 16
Note: TODO . . . . . . . . . . . . . . . . . . 17
Note: TODO . . . . . . . . . . . . . . . . . . 17
Note: TODO . . . . . . . . . . . . . . . . . . 17
Note: TODO . . . . . . . . . . . . . . . . . . 17
Note: TODO . . . . . . . . . . . . . . . . . . 17
Note: TODO . . . . . . . . . . . . . . . . . . 17
Note: TODO . . . . . . . . . . . . . . . . . . 17
Note: TODO . . . . . . . . . . . . . . . . . . 17
Note: TODO . . . . . . . . . . . . . . . . . . 17
Note: TODO . . . . . . . . . . . . . . . . . . 19
Note: TODO . . . . . . . . . . . . . . . . . . 20
Note: TODO . . . . . . . . . . . . . . . . . . 21
Note: TODO . . . . . . . . . . . . . . . . . . 21
Note: TODO . . . . . . . . . . . . . . . . . . 21
Note: TODO . . . . . . . . . . . . . . . . . . 21
Note: TODO . . . . . . . . . . . . . . . . . . 21
Note: TODO . . . . . . . . . . . . . . . . . . 21
Note: TODO . . . . . . . . . . . . . . . . . . 21
Note: TODO . . . . . . . . . . . . . . . . . . 21

vi
Part I

Important General Concepts

1
Chapter 1
The Organization of the
Screen

Chapter 2
Kinds of User Input

Chapter 3
Keys

Chapter 4
Keys and Commands

Chapter 5
Entering Emacs

Chapter 6
Exiting Emacs
C-x C-c (save-buffers-kill-terminal)
Kill Emacs, but prompt to save modified
2
buffers beforehand.
C-z (suspend-emacs) Suspend Emacs if it is
running on a text terminal, minimize Emacs
if it is running on a graphical display.
(kill-emacs) Kill Emacs.
[confirm-kill-emacs] If non-nil, C-x C-c
calls that function when invoked; if that func-
tion returns non-nil, kill Emacs, else Emacs
continues to run. [yes-or-no-p] is a useful
value.

3
Part II

Fundamental Editing Commands

4
7.2 Changing the Location of Point
C-f (forward-char) Move point one character
forward.
Chapter 7 <RIGHT> (right-char) Move point one charac-
ter right; this means backward if RTL.
C-b (backward-char) Move point one character
Basic Editing backward.
<LEFT> (left-char) Move point one character
Commands left; this means forward if RTL.
C-n, <DOWN> (next-line) Move point down one
7.1 Inserting Text screen line, retaining visual horizontal posi-
tion as much as possible.
graphic-character (self-insert- C-p, <UP> (previous-line) Move point up one
command) Insert graphic-character screen line, retaining visual horizontal posi-
itself into the buffer at point. tion as much as possible.
<RET> (newline) Insert newline character at C-a, <Home> (move-beginning-of-line)
point, then indentation after. Move point to the beginning of the line.{Note:
C-j ({Note: TODO} ) Insert newline character at TODO: invoked twice}
point without indenting. C-e, <End> (move-end-of-line) Move point
<DEL> (delete-backward-character) to the end of the line.
Delete character before point. M-f (forward-word) Move point to next end of
C-q (quoted-insert) If followed by non- word.
graphic character, inserts that character. If C-<RIGHT>, M-<RIGHT> (right-word) Move
followed by octal digits terminated by RET, point to nearest right boundary of word to
insert character whose address is specified the right of point. This means previous start
by that octal number. We may terminate of word if RTL.
non-digit as well, in which case we append M-b (backward-word) Move point to previous
that non-digit after as well. start of word.
With M-n Insert n copies of the quoted char- C-<LEFT>, M-<LEFT> (left-word) Move point
acter instead of 1. to nearest left boundarboundaryy of word to
C-x 8 char, A-char Insert a common Unicode the left of point. This means next end of word
character, depending on char. See C-x 8 if RTL.
C-h for mapping. M-r (move-to-window-line-top-bottom)
With M-n Insert n copies of the quoted char- Move point to left margin of centermost line
acter instead of 1. in window.
C-x 8 <RET> (insert-char) Prompt for Uni- Invoked twice Move point to left margin of
code name or code-point of a Unicode charac- top-most line.
ter. Codepoint is specified in hexadecimal by Invoked thrice Move point to bottom margin
default, else explicit radix required. Inserts of top-most line.
corresponding character. With C-u Move point to top row.
With M-n Insert n copies of the quoted char- With M-n Move point to nth row from top of
acter instead of 1. window (top row is zeroth).
[read-quoted-char-radix] May be set to 10 With M-- n Move point to nth row from bot-
or 16. Changes base of digits read by C-q. If tom of window (bottom row is first).
16, a-f are digits as well, case insignificant. M-< (beginning-of-buffer) Move point to the
start of the buffer.
With M-n Move to the line n/10 from the top.
M-> (end-of-buffer) Move point to the end of
the buffer.

5
C-v, <PageDown>, <next> (scroll-up- 7.5 Files
command)
M-v, <PageUp>, <prior> (scroll-down- C-x C-f (find-file) Prompt for a filename in
command) minibuffer. Open file in a new buffer if exists,
M-g c Read a number n and move to the nth char- else create a new buffer with associated with
acter in a buffer. that that filename.
M-g M-g, M-g g (goto-line) Read a number n C-x C-s (save-buffer) Saves a buffers con-
and move to the beginning of line n, with the tents to its associated file.
top line being line 1.
With M-n Go to line n. 7.6 Help
C-x C-nset-goal-column Remember the current
column. Then C-n and C-p always try to C-h k (describe-key) Prompts for a key, then
move to this column after moving lines. opens help for that key.
With C-u Cancel the goal column. C-h, <F1> Prefix key for help commands.
[line-move-visual] If nil, then C-n, C-p,
<DOWN>, <UP> moves down and up logical
lines, not screen lines.
7.7 Blank Lines
[track-eol] If non-nil, and [line-move- C-o (open-line) Insert a blank line after point.
visual] is nil, then invoking C-n or C-p With M-n Insert n blank lines instead.
from the end of a logical line stays at the end C-x C-o (delete-blank-lines)
of the end of the points new logical line after If point is in a run of several blank lines Delete
moving. all but one of those blank lines.
[next-line-add-newlines] If non-nil, in- If point is on an isolated blank line Delete that
voking C-n while at the last line appends a blank line.
newline at the end of the buffer and moves to If point is on a nonblank like If following line
that line. begins run of one or more blank lines,
delete that run.
7.3 Erasing Text
<DEL>, <BACKSPACE> (delete-backward-
7.8 Continuation Lines
char) Delete character before point. {Note: TODO}
With M-n Delete n characters instead.
With active region Delete region instead.
<Delete> (delete-forward-char) Delete 7.9 Cursor Position Information
character after point.
With active region Delete region instead. (what-line) Display line number of point.
C-d (delete-char) Delete character after point. (line-number-mode) Toggle persistent display
C-k (kill-line) Kill from point to end of line. of line number at mode line.
M-d (kill-word) Kill from point to next end of (column-number-mode) Toggle persistent dis-
word. play of column number at mode line.
M-<DEL> (backward-kill-word) Kill from M-= (count-words-region) Display number of
point to previous start of word. lines, words, and characters in current re-
gion.
(count-words) Display number of lines, words,
7.4 Undoing Changes and characters in buffer.
With active region As (count-words-
C-/ (undo) Undo one entry of the undo records. region) instead.
C-x u, C-_ As C-/. C-x = (what-cursor-position) Display char-
acter code of character after point, and the

6
character position of point, and the column of
point.
(hl-line-mode) Toggle highlighting of the cur-
rent line.
(size-indication-mode) Toggle persistent Chapter 8
display of buffer size in mode line.

7.10 Numeric Arguments


The Minibuffer
{Note: TODO}
M-n, C-u n (digit-argument)
M--, C-u - (negative-argument)
C-u (universal-argument)
After a numeric argument, C-u has the special
meaning of terminating the prefix, hence a follow-
Chapter 9
ing digit would not be interpreted as part of the nu-
meric argument. Running Commands by
Where commands dont have special handling
of C-u, it means four times. Name
{Note: TODO}
{Note: TODO}
7.11 Repeating a Command
C-x z (repeat) Repeat the previous Emacs com-
mand with the arguments it was given. Chapter 10
Subsequently typing zs, after first invocation
Continues to repeatedly invoke that re-
peated command per each z.
Help
{Note: TODO}

7
Part III

Important Text-Changing Commands

8
With M-- n Set mark at nth previous start of
paragraph instead.
With active region If active mark is after
point, advance it to next end of para-
Chapter 11 graph. If active mark is before point,
move it back to previous start of para-

The Mark and the graph.


C-M-h (mark-defun) Move point to start of cur-

Region
rent defun, and mark at end of defun.
With M-n Set mark at nth next end of defun
instead.
{Note: TODO} With M-- n Set mark at nth previous start of
defun instead.
11.1 Setting the Mark With active region If active mark is after
point, advance it to next end of defun. If
C-<SPC> (set-mark-command) Set mark at active mark is before point, move it back
point, then activate it. to previous start of defun.
C-@ As C-<SPC> C-x C-p (mark-page) Move point to start of cur-
C-x C-x (exchange-point-and-mark) Set rent page, and mark at end of current page.
mark at point, activate it, then move point to With M-n Set mark at nth next end of page in-
where mark was. stead.
With M-- n Set mark at nth previous start of
page instead.
11.2 Commands to Mark Textual Objects With active region If active mark is after
M-@ (mark-word) Set mark at next end of word. point, advance it to next end of page. If
With M-n Set mark at nth next end of word. active mark is before point, move it back
With M-- n Set mark at nth previous start of to previous start of page.
word. C-x h (mark-whole-buffer) Move point to
With active region If active mark is after start of buffer, and mark at end of buffer.
point, advance it to next end of word. If
active mark is before point, move it back 11.3 Operating on the Region
to previous start of word.
C-M-@ (mark-sexp) Set mark at next end of bal- {Note: TODO}
anced expression. [use-empty-active-region] If t, then com-
With M-n Set mark at nth next end of bal- mands that perform default behavior if region
anced expression. is empty perform for-region behavior on the
With M-- n Set mark at nth previous start of empty region instead.
balanced expression. [delete-active-region] If nil, then <DEL>
With active region If active mark is after and Delete do not delete region instead if an
point, advance it to next end of bal- active region exists.
anced expression. If active mark is be- [mark-even-if-inactive] If nil, then com-
fore point, move it back to previous start mands that always operate on region will sig-
of balanced expression. nal an error if the mark is inactive instead of
M-h (mark-paragraph) Move point to start of operating on the inactive region
current paragraph, and mark at end of cur- (delete-selection-mode) Toggle Delete Se-
rent paragraph. lection mode. If on, commands that insert
With M-n Set mark at nth next end of para- text delete text in active region first if present,
graph instead. and commands that normally delete just one
character instead delete text in active region.

9
11.4 The Mark Ring 11.7 Disabling Transient Mark Mode
By cycle, we mean that we read the topmost entry Transient Mark mode is on by default.
off a ring, then push it to the bottommost entry. (transient-mark-mode) Toggles Transient
Mark rings are buffer-local. Mark mode. When off, setting the mark does
C-<SPC>, C-@ [set-mark-command] Set the not highlight the region. Then commands
mark. that ordinarily act on the active region if it
Invoked twice Set, then disable the mark; exists exhibit default behavior instead.
hence pushing it onto the mark ring. C-<SPC>, C-@ C.f. earlier.
With C-u Cycles mark off the mark ring, so With Transient Mark mode off, invoked twice
that point moves to that mark; that mark Set the mark at point, and enable Tran-
is not active. sient Mark mode for that point until it is
[set-mark-command-repeat-pop] If deactivated.
non-nil, then after C-u C-<SPC> has C-x C-x C.f. earlier.
been invoked, immediately consecutive With Transient Mark mode off, With C-u Ex-
C-<SPC> cycles the mark ring instead of change point and mark, and enable
default behavior. Transient Mark mode for that mark un-
[mark-ring-max] Defaults to 16. Maximum til it is deactivated.
number of mark entries in the mark ring.

11.5 The Global Mark Ring


Chapter 12
Whenever we add a mark to the mark ring, we also
add it to the global mark ring.
[global-mark-ring-max] Defaults to 16. Max-
Killing and Moving Text
imum number of mark entries in the mark
ring. 12.1 Deletion and Killing
C-x C-<SPC> (pop-global-mark) Cycles
12.1.1 Deletion
mark off the global mark ring, so that we
activate the buffer of the last mark, and move <DEL>, <BACKSPACE> (delete-backward-
its point to the marks location in buffer. char)
<Delete> (delete-forward-char)
11.6 Shift Selection C-d (delete-char) Delete character after point.
M-
As long as it is not already bound to another com- (delete-horizontal-space) Delete
mand, we may hold down the shift key while invok- spaces and tabs around point.
ing a cursor motion command to invoke a shifted With C-u Delete only spaces and tabs before
cursor motion: we set the mark, and the cursor point.
motion command moves that mark instead of the M-<SPC> (just-one-space) Replace spaces
point; immediately consecutive shifted cursor mo- and tabs around point with one space before
tion operates on that mark instead. The mark is point.
deactivated by any unshifted cursor motion. With C-u Leave no spaces.
A mark set via mouse commands ts treated as With M-n Leave n spaces before point in-
though it has been created with shift-selection. stead.
[shift-select-mode] If nil, shift-selection is With M-- Replace newlines too, leave no
disabled. Mouse selection is still enabled. spaces.
With M-- n Replace newlines too, leave n
spaces before point.
(cycle-spacing) Replace spaces and tabs be-

10
fore and after point with one space before M-z (zap-to-char) Prompt for a character
point. char. Kill through the next occurrence of
Invoked twice Delete all spaces and tabs be- char.
fore and after point instead. With M-n Do it n times with the same char
Invoked thrice Does nothing instead. instead.
C-x C-o (delete-blank-lines) Delete blank With M-- Kill backwards instead.
lines after the current line. With M-- n As M-n, but backwards instead.
With current line blank Delete all blank lines
before and after current line; if current 12.1.4 Options for Killing
line is surrounded by non-blank lines,
delete current line. Kill commands on a read-only buffer copy to the
M-^ (delete-indentation) Join current line kill ring and signal an error instead.
with previous line, replacing indentation [kill-read-only-ok] If non-nil, echo ex-
whitespace with a single space. planatory text instead of signalling error.
(delete-duplicate-lines) Within region, [kill-do-not-save-duplicates] If
delete all but first copy of lines. non-nil, identical subsequent kill-ring
With C-u Delete all but last copy instead. entries are not recorded.
With C-u C-u Delete adjacent copies only.
With C-u C-u C-u Do not delete repeated 12.2 Yanking
blank lines.
C-y (yank) Set last-yanked pointer to top of kill
12.1.2 Killing by Lines ring, then yank pointed entry into buffer be-
fore point. Set mark before yank, unactivated.
C-k (kill-line) Kill from point to EOL. With C-u Yank after point instead, set mark
With point after last visible character of line after yank instead.
Kill newline character instead. With M-n Yank (1-indexed) nth kill from last-
With M-n Kill n lines and their trailing new- yanked pointer.
lines, inclusive of point to EOL. After C-y or M-y Use current last-yanked
With M-- Kill beginning of line to point in- pointer instead of setting a new one.
stead. With graphical Emacs If there exists more re-
With M-- n Kill n preceding lines and their cent text on system clipboard, paste that
trailing newlines, exclusive of beginning text instead. Numeric arguments more
of line to point. than 1 use the kill ring as per default.
C-S-<backsapce> (kill-whole-line) Kill M-y (yank-pop) Following a yank, cycle yanked
current line, including terminating newline. text and last-yanked pointer down the kill
ring.
12.1.3 Other Kill Commands With M-n Cycle n entries instead.
With M-- Cycle back an entry instead.
C-w (kill-region) Kill the region.
With M-- n Cycle back n entries instead.
M-w (kill-ring-save) Copy region to kill ring.
Successive invocations Cycle yanked/cycled
M-w (kill-word) Kill to next end of word.
text down the kill ring.
M-<DEL> (backward-kill-word) Kill to previ-
C-M-w (append-next-kill) If the next com-
ous start of word.
mand kills, it adds to the top kill ring entry in-
M-k (kill-sentence) Kill to next end of sen-
stead of pushing a new one, as though in the
tence.
same of previous kill commands.
C-x <DEL> (backward-kill-sentence) Kill
to previous start of sentence.
C-M-k (kill-sexp) Kill following balanced ex- 12.2.1 The Kill Ring
pression. {Note: TODO: clarify} The kill ring is global.

11
[kill-ring-max] Defaults to 60. Maximum size
of kill ring.
[kill-ring] The kill ring.

12.2.2 Yanking Earlier Kills


Successive kill commands combine their killed
text into a single entry by default.
M-w is not a kill command.

12.3 Cut and Paste Operations on


Graphical Displays
Emacss kill and yank commands integrates with
the system clipboard.

12.3.1 Using the Clipboard


{Note: TODO}

12.3.2 Cut and Paste with Other Window Appli-


cations
{Note: TODO}

12.3.3 Secondary Selection


{Note: TODO}

12.4 Accumulating Text


(append-to-buffer) Prompt for a buffer. If
buffer nonexistent, create that buffer. Ap-
pend region to that buffer before point.
(prepend-to-buffer) As (append-to-
buffer), but put text before point instead.
(copy-to-buffer) As (append-to-buffer),
but preexisting content in buffer is deleted
begfore appending.
(insert-buffer) Prompt for a buffer. Insert
contents of that buffer after point. Set deac-
tivated mark after inserted content.
(append-to-file) Prompt for filename. Ap-
pend region to end of file. Should not be
used on files opened by Emacs to maintain
filebuffer synchronization.

12
12.5 Rectangles

12.6 CUA Bindings

Chapter 13
Registers
{Note: TODO}

Chapter 14
Controlling the Display
{Note: TODO}

Chapter 15
Searching and
Replacement
{Note: TODO}

Chapter 16
Commands for Fixing
Typos
{Note: TODO}

Chapter 17
Keyboard Macros
{Note: TODO}
13
Part IV

Major Structures of Emacs

14
We may use drag and drop to open a file. If we
drop a file into a Dired buffer we copy or move the
file into that folder shown by Dired instead.
When visited, Emacs automatically detects its
Chapter 18 character encoding and EOL convention, and con-
verts them into Emacs internal encoding and EOL

File Handling convention in the buffer. Saving performs the in-


verse conversion.
C-x C-f (find-file) Visit a file.
{Note: TODO} C-x C-r (find-file-read-only) Visit a file
read-only.
18.1 File Names C-x C-v (find-alternate-file) Prompt to
save the current buffer, kill it, and visit a dif-
[completion-ignored-extensions] Files ferent file.
whose extensions appear in this variable are C-x 4 f (find-file-other-window) Visit a
ignored for file completion. file in another window, if not already visited
[default-directory] Buffer-local variable. in another window.
When Emacs prompts for a file name, it starts C-x 5 f (find-file-other-frame) Open a
off with the value of this variable as a prefix. new frame and visit a file in that frame, if not
[insert-default-directory] If nil, does already visited in another frame.
not insert value of [default-directory] C-x C-q (read-only-mode) Toggles read-only
when prompting to read a file name. Defaults mode on a buffer.
to the directory of the file associated with the [find-file-literally] Edit a file as a se-
buffer. quence of ASCII characters with no special
(pwd) Echo value of [default-directory]. encoding or conversion.
(cd) Prompt to change the value of [default- [large-file-warning-threshold] Defaults
directory]. to 10000000. In bytes. When opening a
We may use ${...} to interpolate an environ- file larger than this size, Emacs prompts to
ment variable into a file name. Wu escape $ with confirm if we want to open the file.
$$. We may quote the file name with /:. Files be- [find-file-wildcards] If nil, do not inter-
ginnign with a literal should be quoted. polate wildcards in file names.
We may use non-ASCII characters in file names. [find-file-run-dired] If nil, Emacs does
not run Dired upon visiting a directory but
throws an error.
18.2 Visiting Files
[find-file-not-found-functions]
By visiting a file we mean reading it into a new functions hook to run after visiting a
Emacs buffer associated with the file if it doesnt file that does not exist.
already exist, else open that buffer. [find-file-hook] Hook to run after success-
If the file name specified contains shell-style fully visiting a file.
wildcards (viz. ?, *, [...]), Emacs visits all files
that matches. Inputting ? requires quoting. 18.3 Saving Files
If it is a directory we visit, Emacs runs Dired.
If the file is an archive, we visit them in special {Note: TODO}
modes.
If the file is read-only, the buffer starts read-only
too.
18.4 Reverting a Buffer
We may use the menu bar or tool bar to open a {Note: TODO}
file.

15
18.5 Auto Reverting Non-File Buffers 18.9 Comparing Files
{Note: TODO} {Note: TODO}

18.6 Auto-Saving: Protection Against 18.10 Diff Mode


Disasters
{Note: TODO}
{Note: TODO}
18.11 Miscellaneous File Operations
18.7 File Name Aliases
{Note: TODO}
{Note: TODO}
18.12 Accessing Compressed Files
18.8 File Directories
{Note: TODO}
C-x!C-d (list-directory) Prompt for a di-
rectory name or pattern, and display a brief 18.13 File Archives
listing of it.
With C-u Display a verbose listing instead. Emacs views .tar files in Tar mode which is sim-
(make-directory) Prompt for a directory ilar to Dired.
name, creates that directory. Saving saves changes made in buffer to the .tar
(delete-directory) Prompt for a direc- file.
tory name, deletes that directory if empty; The following commands operate when Tar
prompts to delete that directory recursively if mode is active:
not empty. e, f, <RET> Extract a component file into its own
The mechanism of displaying a directory listing buffer; saving that buffer will replace the cor-
is typically through a call to ls. responding file in the archive.
[list-directory-brief-switches] De- v Extract a component file into a buffer in View
faults to -CF. Options passed to ls when mode.
displaying a brief listing. o Extract a component file into a buffer, displayed
[list-directory-verbose-switches] De- in another window.
faults to -l. Options passed to ls when I Add an empty file into the archive before the file
displaying a verbose listing. at point.
In verbose directory listings, Emacs runs addi- d Mark a file for deletion.
tional programs to obtain information about the x Delete deletion-marked files.
amount of free space on disl containing the direc- u Unmark a file.
tory and displays it. C Copy a file out of the archive.
[directory-free-space-program] Name of M Change a files permission bits.
program to run to obtain information of G Change a files group.
amount of free space. O Change a files owner.
[directory-free-space-args] Options Emacs views arc, jar, lzh, zip, rar, 7z, zoo,
passed to [directory-free-space- and self-extracting exe files in Archive mode.
program] when run. {Note: TODO}
[delete-by-moving-to-trash] If t, moves
directories to Trash when deleting it instead
of deleting it irrecoverably.
18.14 Remote Files
Remote files may be opened with the one of the
following forms:

16
/host:filename 18.18 Filesets
/user@host:filename
/user@host#port:filename {Note: TODO}
/method:user@host:filename
/method:user@host#port:filename
Emacs may use the remote access programs
ftp, ssh, rlogin, telnet. Chapter 19
If unspecified, Emacs interprets the method as
follows:
1. If host starts with ftp., if user is ftp Using Multiple Buffers
or anonymous, or if [tramp-default-
{Note: TODO}
method] is ftp, then use FTP.
2. If ssh-agent is running, use scp.
3. Otherwise, use ssh.
{Note: TODO}
Chapter 20
18.15 Quoted File Names
Multiple Windows
{Note: TODO}
{Note: TODO}
18.16 File Name Cache
{Note: TODO}
Chapter 21
18.17 Convenience Features for Finding
Files Frames and Graphical
{Note: TODO} Displays
{Note: TODO}

Chapter 22
International Character
Set Support
{Note: TODO}

17
Part V

Advanced Features

18
[modename-mode] non-nil if mode is enabled,
else nil. Most (not necessarily all) modes de-
fine this.

Chapter 23 23.3 Choosing File Modes

Major and Minor Modes First Emacs checks if the first non-blank line de-
fines a mode (if first line is #! or \", then the next
{Note: TODO} non-blank line). E.g.
-*-Lisp-*-
23.1 Major Modes Equivalently,
[major-mode] Variable that reflects the active -*- mode: Lisp;-*-
major mode of buffer. Otherwise if file begins with magic number #!,
Buffer-local value Defaults to command in- then use the interpreters name to choose a mode.
voking major mode of buffer. Do not Third, determine the major mode with the first
change. This is set before time of enter-
few characters (magic number) with the [magic-
ing mode hooks. mode-alist]. Fourth, determine the major
Default value Mode that Emacs defaults to mode by the files name. If OS has case-sensitive
when opening files that do not specify afilenames, first a case-sensitive search is per-
major mode, and for new buffers. De- formed, then a case-insensitive search. Else, a
faults to (fundamental-mode). If nil, case-insensitive search is used. Finally, it deter-
duplicate the mode of the currently se- mines the major mode by its magic number, using
lected buffer. the [magic-fallback-mode-alist].
C-h m (describe-mode) View the documenta- Commands that save files also automatically
tion of the current major mode; which in- change their mode if their filename becomes set/is
cludes a list of key bindings defined by the ma-
changed.
jor mode. [interpreter-mode-alist] Specifies map-
[modename-mode-hook] Mode hook run when- ping from interpreter program names to
ever mode is entered. Defined for all modes major modes.
but Fundamental mode. [magic-mode-alist] Specifies mapping from
[text-mode-hook] Mode hook run by all text- magic numbers to major modes. C.f. manual
based major modes. for syntax. Defaults to nil.
[prog-mode-hook] Mode hook run by most pro- [auto-mode-alist] Specifies mapping from
gramming language modes, including all that file names to major modes.
are distributed by emacs. [auto-mode-case-fold] Defaults to t. If nil,
suppresses case-insensitive file name search
23.2 Minor Modes on case-sensitive OSes.
[magic-fallback-mode-alist] Specifies
(minormodename-mode) Toggle minor mode. mapping from magic numbers to major
With C-u 0, M--, or M-- n Turn minor modes.
mode off. (normal-mode) Reverts major mode in buffer to
Other universal or numeric arguments Turn mode Emacs whould have selected, and also
minor mode on. processes file variables again.
From Lisp Turn on if argument is omitted or [change-major-mode-with-file-name]
nil, else treat argument as prefix argu- Defaults to t. If nil, does not automatically
ment. change major mode if filename becomes
set/is changed.

19
[electric-quote-paragraph] If non-nil,
Electric Quote converts in text paragraphs.
Defaults to t.
[electric-quote-comment] If non-nil, Elec-
Chapter 24 tric Quote converts in programming language
comments. Defaults to t.
Indentation [electric-quote-string] If non-nil, Elec-
tric Quote converts in programming language
strings. Defaults to nil.
<TAB> (indent-for-tab-command) Default
(electric-quote-mode) Toggle Electric Quote
key binding for text mode and related major
mode globally.
modes. Insert some combination of space
(electric-quote-local-mode) Toggle Elec-
and tab characters to advance point to next
tric Quote for current buffer.
tab stop. Position of first non-whitespace
Suppress Electric Quote by quoting it with C-q.
character of preceding line is also regarded
C-x 8 [
as a tab stop.
C-x 8 ]
With active region Align the first non-
C-x 8 {
whitespace character of each line with
C-x 8 }
preceding line.
<TAB> (c-indent-line-or-region) Default
key binding for programming modes. In- 25.6 Filling Text
dent line in a way that makes sense given
preceding lines. If point is within inden- 25.6.1 Auto Fill Mode
tatiion whitespace, advance it to the first
When Auto Fill mode is on, <SPC> and <RET>
non-whitespace character.
breaks lines where appropriate. Fill appears in
With active region Indent all lines in the re-
the mode line. To avoid this behavior, quote with
fion in this manner.
C-q. C-o does not trigger line breaking.
{Note: TODO}
(auto-fill-mode) Toggle Auto Fill mode.
With C-u Enable Auto Fill mode.
With M-n Enable Auto Fill mode.
With M-- Disable Auto Fill mode.
Chapter 25 With M-- n Disable Auto Fill mode.

Commands for Human 25.6.2 Explicit Fill Commands

Languages M-q (fill-paragraph)


C-x f (set-fill-column)
(fill-region)
25.1 Words (fill-region-as-paragraph)
M-o M-s (center-line)
25.2 Sentences

25.3 Paragraphs

25.4 Pages

25.5 Quotation Marks


Electric Quote automatically converts typewriter
quotes to curved quotes when typed.

20
25.6.3 The Fill Prefix 25.13 Nroff Mode
25.6.4 Adaptive Filling 25.14 Enriched Text
25.7 Case Conversion Commands
25.15 Editing Text-based Tables
25.8 Text Mode
25.16 Two-Column Editing
25.9 Outline Mode

25.10 Org Mode

25.11 TeX Mode Chapter 26


25.12 SGML and HTML Modes Editing Programs
C-c C-n (sgml-name-char) Interactively spec- {Note: TODO}
ify and insert an ampersand-escaped charac-
ter.
C-c C-t (sgml-tag) Interactively specify a tag
and its attributes.
With M-n Put tag around n words after point.
Chapter 27
With active region Put tag around region.
With M-- If Transient Mark mode is off, put Compiling and Testing
tag around region.
C-c C-a (sgml-attributes) Interactively in- Programs
sert attribute values for current tag.
C-c C-f (sgml-skip-tag-forward) {Note: 27.1 Running Compilations under Emacs
TODO}
C-c C-b (sgml-skip-tag-backward) {Note: (compile) Prompt for shell command line,
TODO} execute it as a shell as a subprocess, and
C-c C-d (sgml-delete-tag) {Note: TODO} current buffers default directory as work-
C-c ? (sgml-tag-help) Prompt for tag. Dis- ing directory. Print output in buffer called
play a description of tag. If empty, describe *compilation* in inactive other win-
tag at point. dow. Defaults to make -k, or [compile-
C-c / (sgml-close-tag) {Note: TODO} command] if specified.
C-c 8 (sgml-name-8bit-mode) {Note: TODO} (recompile) Rerun last compilation with same
C-c C-v (sgml-validate) {Note: TODO} commands.
C-c <TAB> (sgml-tags-invisible) {Note: (kill-compilation)
TODO} [compilation-scroll-output] If non-nil,
{Note: TODO} *compilation* scrolls automatically when
new output appears. If first-error, stops
scrolling when first error appears.
[compilation-always-kill] If t, starting a
new compilation while one is running does
not prompt to kill current *compilation*
buffer but does it noninteractively.
[compilation-environment] A list of
envvarname=value strings. Added/over-
writes environment when starting compila-

21
tion. 28.1.1.2 Supported Version Control Systems
SCCS Lock-based.
27.2 Compilation Mode CSSC
RCS Lock-based, merge-based possible.
27.3 Subshells for Compilation CVS Merge-based, lock-based possible.
Subversion (svn) Merge-based, lock-based possi-
27.4 Searching with Grep under Emacs ble.
Git Merge-based.
27.5 Finding Syntax Errors on the Fly Mercurial (hg) Merge-based.
Bazaar (bzr)
27.6 Running Debuggers Under Emacs SRC

27.7 Executing Lisp Expressions 28.1.1.3 Concepts of Version Control

27.8 Libraries of Lisp Code for Emacs A file under version control A file registered in the
version control system.
27.9 Evaluating Emacs Lisp Expressions Work file The version of a version controlled file
available for edit.
27.10 Lisp Interaction Buffers Committing Recording changes to current work
files into the version control system.
27.11 Running an External Lisp Working tree A directory tree of work files.
Revision What each commit of recoreded changes
creates.
Revision ID A name to identify revisions.

Chapter 28 28.1.1.4 Merge-based vs Lock-based Version


Control
Maintaining Large Merge-based Each user may modify a work file at
any time. The system lets us merge changes
Programs with other users changes. Merge conflicts
happen when two changes modify the same
28.1 Version Control file in incompatible ways.
Lock-based Work files are read-only by default. A
28.1.1 Introduction to Version Control user who wishes to make changes requests
write access, and doing so locks itonly one
28.1.1.1 Understanding the problems it ad- user can lock a file at any given time. Com-
dresses mitting a file unlocks it. Lock conflicts hap-
pen when more than one user needs access
VCSs provide three important capabilities:
to the same file.
Reversibility Previous states of a project can be
backed up and restored.
Concurrency Allows multiple people to modify a 28.1.1.5 Changeset-based vs File-based Version
project simultaneously and merge edits to- Control
gether, providing tools to resolve conflicts.
File-based Each file has its own comment and re-
History Allows one to attach historical data and
vision history.
explanations to a project as it matures.
Changeset-based Each commit records changes
that may involve multiple files. This is
more useful; may record changes in existence

22
of files and easier to manage multiple-file 28.1.3 Basic Editing under Version Control
changes.
A VC fileset is a collection of one or more files. In
a buffer visiting a version-controlled file, the cor-
28.1.1.6 Decentralized vs Centralized Reposito- responding VC fileset is just that one file. In a VC
ries Directory biffer, the fileset is the marked files.
On changeset-based VCS, VC commands handle
Centralized repositories All developers share the
multi-file VC filesets as a single action. On file-
same repository.
based VCS, they correspond to a separate action
Decentralized/distributed repositories Each de-
per changed file.
veloper works on a separate repository, and
C-x v v (vc-next-action) Perform the most
repositories reconcile with each other.
appropriate VC action on the current fileset.
VC manages only your relationship with one
This includes registering it, committing it, un-
repository, regardless of whether that repository
locking it, or merging changes into it.
is a central repository or your personal repository
On merge-based VCS If the files in the VC file-
in a distributed system.
set have inconsistent version control sta-
tus, signal error. If no files are regis-
28.1.1.7 Types of Log File tered, register all of them; if no repos-
Version control log Log maintained by the VCS. itory is detected, prompt for a VCS to
ChangeLog File recording all changes to large manage it under. If all work files are un-
portions of a program. More useful in file- changed, do nothing. If all work files are
based VCS to identify multiple file changes. modified, commit; C-c C-c to commit
When the policy is to use both kilds of logs, you log message. If using a centralized VCS,
typocally want to write the entry in ChangeLog check if all files are up-to-date and offer
then copy it to the log buffer with C-c C-a when to update.
committing. Or write it in the log buffer while On lock-based VCS {Note: TODO}
committing, then use C-x v a to copy it to the With C-u Prompts; one may specify VCS or if
ChangeLog. using CVS or RCS, a revision IDif file
is modified or locked, commits with that
revision ID, but if inmodified and un-
28.1.2 Version Control and the Mode Line locked checks out that specified revision.
When we visit a file that is version controlled in the
buffer, the VCS name and revision ID is indicated 28.1.3.1 Basic Version Control with Merging
in the mode line. The character between the re-
vision ID and the file name indicates the status of 28.1.3.2 Basic Version Control with Locking
the file:
28.1.4 Features of the Log Entry Buffer
Merge-based VCS - Work file is unmodified.
: Work file is modified. While in Log Edit mode, current VC fileset is fileset
! Merge conflicts exist in work file. to be committed.
? Work file is under version control, but is Commands that operate on the *vc-log*
missing from working tree. buffer, with major mode the Log Edit mode.
Lock-based VCS - Work file is unlocked. C-c C-c (log-edit-done) Exit log entry buffer
: Work file is locked by you. and commit using the message in the buffer.
:user Work file is locked by user. C-c C-f (log-edit-show-files) View files
@ Work file is locally added, but not commit- in VC fileset.
ted. C-c C-d (log-edit-show-diff) View diff of
{Note: TODO} changes to be committed.
C-c C-a (log-edit-insert-changelog)
If VC fileset inclodes ChangeLog(s), pull
relevant entries from them into *vc-log*

23
buffersearch items under your user name C-x v D (vc-root-diff) Compare entire
on the current date for entries and insert working tree to revision started from.
them. With C-u Prompt for two revisions to diff
M-n Cycle back previous log entries. working tree between instead. Not reli-
M-p Cycle forward previous log entries. able under file-based VCS.
M-s Prompt for a substring. Search forward log C-x v ~ (vc-revision-other-window)
entries for substring. While visiting single version controlled
M-r Prompt for a substring. Search back log en- file. Prompt for revision. Retrive re-
tries for substring. vision revision of current file, save to
[text-mode-hook] Runs when entering Log filename. revision , and visit it in a
Edit mode as well. separate window.
[vc-log-mode-hook] Run when entering Log C-x v g (vc-annotate) While visiting single
Edit mode. version controlled file, open in new buffer,
We may specify headers; each occupying a sin- each line colored and annotated by when it
gle line before any non-header line. Headers have was committed and by whom. Red is new,
the format Header-Type: value . Valid head- blue is old.
ers are: With C-u Prompt for a revision to annotate
Author Recognized by Git, Mercurial, Mono- and for a time span in days to range the
tone, Bazaar colors over.
Date Recognized by Git, Mercurial, Monotone, [vc-annotate-background-mode] If
Bazaar non-nil, colors are applied to the back-
Fixes Reference to bug fixed by commit. Recog- ground; if nil, colors are applied to the
nized by Bazaar. foreground.
From Annotate mode, {Note: TODO}
28.1.5 Registering a file for Version Control
28.1.7 VC Change Log
[C-x v i] (vc-register) Register current VC
fileset. Signal error if already registered. C-x v l (vc-print-log) Show change log for
If from a VC Directory buffer, or if in the current file, or if from VC Directory or Dired,
work directory of a VCS, it specifies which the file at point, with point at currently visited
VCS to use; if more than one is applica- revision.
ble, Emacs uses the foremost one in [vc- With C-u Prompt for revision to put point at,
handled-backends]. Else prompt for de- and maximum number of revisions to
tails to create a new repository. Under most display.
VCS, registering adds a file to the working tree C-x v L (vc-print-root-log) Show change
but not to the repository. They are labeled log for repository.
added in the VC Directory buffer and have a With C-u Prompt for maximum number of
revision ID of @@. Under a lock-based VCS, revisions to display.
registering leaves the file unlocked and read- C-x v I (vc-log-incoming) {Note: TODO}
only. C-x v O (vc-log-outgoing) {Note: TODO}
{Note: TODO}
28.1.6 Examining and Comparing Old Revisions
28.1.8 Undoing Version Control Actions
C-x v = (vc-diff) Diff VC fileset against revi-
sion started from. C-x v u (vc-revert) Revert work files in cur-
With C-u Prompt for two revisions to diff rent VC fileset to last revision. {Note: TODO}
VC fileset between instead. Not reliable
for multi-file VC filesets under file-based
VCS.
(vc-ediff) As C-x v =, but using Ediff instead.

24
28.1.9 Ignore Version Control Files q (quit-window) Bury Dired buffer, delete its
window if created alongside that Dired buffer.
28.1.10 VC Directory Mode [dired-listing-switches] Options for Dired
28.1.11 Version Control Branches to pass to ls. May contain both long and/or
short options. Must contain -l.
28.1.12 Miscellaneous Commands and Fea- [dired-use-ls-dired] Defaults to
tures of VS unspecified, meaning always check if
ls supports --dired. If nil, then never
28.1.13 Customizing VC pass --dired. Otherwise, always pass
--dired.
28.2 Change Logs

28.3 Find Identifier References 30.2 Navigation in the Dired Buffer

28.4 Emacs Development Environment <SPC>, n, C-n Move down one line.
p, C-p Move up one line.
28.5 Merging Files with Emerge <DEL> Unflag and move down one line.
j (dired-goto-file) Prompt for a file name,
{Note: TODO} move point to matching line.
M-s f C-s (dired-isearch-filenames)
Performs Isearch for file names only.
M-s f M-C-s (dired-isearch-filenames-
regexp) Performs regex search for file
Chapter 29 names only.
[dired-isearch-filenames] If t, limit
Isearch to file names only. If dwim, limiting
Abbrevs behavior only if point begins search while on
file name.
{Note: TODO}
30.3 Deleting Files with Dired
d (dired-flag-file-deletion)
Chapter 30 u (dired-unmark)
<DEL> (dired-unmark-backward)
Dired, the Directory x (dired-do-flagged-delete)
{Note: TODO}
Editor [dired-recursive-deletes] If non-nil,
then deleting nonempty directories is possi-
ble.
30.1 Entering Dired [delete-by-moving-to-trash] If t, then
C-x d (dired) Prompt for a folder to open in move files and folders being deleted to Trash
Dired. instead of permanently deleting.
C-x C-f (find-file) Prompt for a file; opens
in Dired if given a directory file. 30.4 Flagging Many Files at Once
C-x 4 d (dired-other-window) Open Dired
in another window. # (dired-flag-auto-save-files) Flag all
C-x 5 d (dired-other-frame) Open Dired in auto-save files for deletion.
another frame. ~ (dired-flag-backup-files) Flag all
While in Dired: backup files for deletion.

25
. (dired-clean-directory) Flag excess nu- 30.6 Dired Marks vs. Flags
meric backup files (all but oldest and newest)
for deletion. {Note: TODO} 30.7 Operating on Files
% & (dired-flag-garbage-files) Flag files
for deletion whose names suggest that they 30.8 Shell Commands in Dired
are easily recreatable. {Note: TODO}
% d (dired-flag-files-regexp) Prompt for 30.9 Transforming File Names in Dired
a regular expression. Flag for deletion all files
that match. 30.10 File Comparison with Dired

30.5 Visiting Files in Dired 30.11 Subdirectories in Dired

f, <RET>, e (dired-find-file) 30.12 Subdirectory Switches in Dired


o (dired-find-file-other-window)
C-o (dired-display-file) Visit file in an- 30.13 Moving Over Subdirectories
other window, but do not select that window.
mouse-1, mouse-2 (dired-moust-find- 30.14 Hiding Subdirectories
file-other-window)
v (dired-view-file) 30.15 Updating the Dired Buffer
^ (dired-up-directory)
30.16 Dired and Find

30.17 Editing the Dired Buffer

30.18 Viewing Image Thumbnails in


Dired

30.19 Other Dired Features

26
Part VI

Recovery from Problems

27
Part VII

Appendices

28
Indexes

29

You might also like