Notes To The Emacs Manual: Johannes Choo
Notes To The Emacs Manual: Johannes Choo
Johannes Choo
i
Contents
Contents ii
3 Keys 2
5 Entering Emacs 2
6 Exiting Emacs 2
8 The Minibuffer 7
10 Help 7
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
13 Registers 13
17 Keyboard Macros 13
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
20 Multiple Windows 17
iii
21 Frames and Graphical Displays 17
V Advanced Features 18
24 Indentation 20
26 Editing Programs 21
iv
28.4 Emacs Development Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
28.5 Merging Files with Emerge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
29 Abbrevs 25
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
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
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
Part III
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-
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.
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
12.5 Rectangles
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
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
15
18.5 Auto Reverting Non-File Buffers 18.9 Comparing Files
{Note: TODO} {Note: TODO}
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.
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.
25.3 Paragraphs
25.4 Pages
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
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.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.
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.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
26
Part VI
27
Part VII
Appendices
28
Indexes
29