Tải bản đầy đủ (.pdf) (561 trang)

22.1 emacs manual

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (3.19 MB, 561 trang )

GNU Emacs Manual

GNU Emacs Manual
Sixteenth Edition, Updated for Emacs Version 22.1.
Richard Stallman
This is the Sixteenth edition of the GNU Emacs Manual,
updated for Emacs version 22.1.
Copyright
c
 1985, 1986, 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document under
the terms of the GNU Free Documentation License, Version 1.2 or any later
version published by the Free Software Foundation; with the Invariant Sections
being “The GNU Manifesto,” “Distribution” and “GNU GENERAL PUBLIC
LICENSE,” with the Front-Cover texts being “A GNU Manual,” and with the
Back-Cover Texts as in (a) below. A copy of the license is included in the
section entitled “GNU Free Documentation License.”
(a) The FSF’s Back-Cover Text is: “You have freedom to copy and modify
this GNU Manual, like GNU software. Copies published by the Free Software
Foundation raise funds for GNU development.”
Published by the Free Software Foundation
51 Franklin Street, Fifth Floor
Boston, MA 02110-1301 USA
ISBN 1-882114-86-8
Cover art by Etienne Suvasa.
i
Short Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5


1 The Organization of the Screen . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2 Characters, Keys and Commands . . . . . . . . . . . . . . . . . . . . . . . 11
3 Entering and Exiting Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4 Basic Editing Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
5 The Minibuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
6 Running Commands by Name . . . . . . . . . . . . . . . . . . . . . . . . . . 35
7 Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
8 The Mark and the Region . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
9 Killing and Moving Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
10 Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
11 Controlling the Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
12 Searching and Replacement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
13 Commands for Fixing Typos . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
14 Keyboard Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
15 File Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
16 Using Multiple Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
17 Multiple Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
18 Frames and Graphical Displays . . . . . . . . . . . . . . . . . . . . . . . . 159
19 International Character Set Support . . . . . . . . . . . . . . . . . . . . 173
20 Major Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
21 Indentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
22 Commands for Human Languages . . . . . . . . . . . . . . . . . . . . . . 198
23 Editing Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
24 Compiling and Testing Programs . . . . . . . . . . . . . . . . . . . . . . . 254
25 Maintaining Large Programs . . . . . . . . . . . . . . . . . . . . . . . . . . 272
26 Abbrevs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
27 Sending Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
28 Reading Mail with Rmail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
29 Dired, the Directory Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
30 The Calendar and the Diary . . . . . . . . . . . . . . . . . . . . . . . . . . 329

31 Miscellaneous Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
32 Customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
ii
33 Dealing with Common Problems . . . . . . . . . . . . . . . . . . . . . . . 409
A GNU GENERAL PUBLIC LICENSE . . . . . . . . . . . . . . . . . . . 423
B GNU Free Documentation License . . . . . . . . . . . . . . . . . . . . . . 429
C Command Line Arguments for Emacs Invocation . . . . . . . . . . 436
D X Options and Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452
E Emacs 21 Antinews. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458
F Emacs and Mac OS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462
G Emacs and Microsoft Windows/MS-DOS . . . . . . . . . . . . . . . . 467
The GNU Manifesto . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482
Key (Character) Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504
Command and Function Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512
Variable Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523
Concept Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529
iii
Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1 The Organization of the Screen . . . . . . . . . . . . . . . 6
1.1 Point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2 The Echo Area. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.3 The Mode Line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.4 The Menu Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2 Characters, Keys and Commands . . . . . . . . . . . . 11
2.1 Kinds of User Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

2.2 Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3 Keys and Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.4 Character Set for Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3 Entering and Exiting Emacs . . . . . . . . . . . . . . . . . . 15
3.1 Exiting Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4 Basic Editing Commands . . . . . . . . . . . . . . . . . . . . . 18
4.1 Inserting Text. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.2 Changing the Location of Point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.3 Erasing Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.4 Undoing Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.5 Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.6 Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.7 Blank Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.8 Continuation Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.9 Cursor Position Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.10 Numeric Arguments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.11 Repeating a Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
iv
5 The Minibuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.1 Minibuffers for File Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.2 Editing in the Minibuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
5.3 Completion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
5.3.1 Completion Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
5.3.2 Completion Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
5.3.3 Strict Completion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
5.3.4 Completion Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
5.4 Minibuffer History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
5.5 Repeating Minibuffer Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
6 Running Commands by Name . . . . . . . . . . . . . . . 35
7 Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

7.1 Documentation for a Key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
7.2 Help by Command or Variable Name . . . . . . . . . . . . . . . . . . . . . . . . . . 38
7.3 Apropos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
7.4 Help Mode Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
7.5 Keyword Search for Lisp Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
7.6 Help for International Language Support . . . . . . . . . . . . . . . . . . . . . . 42
7.7 Other Help Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
7.8 Help Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
7.9 Help on Active Text and Tooltips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
8 The Mark and the Region . . . . . . . . . . . . . . . . . . . . 45
8.1 Setting the Mark . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
8.2 Transient Mark Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
8.3 Using Transient Mark Mode Momentarily . . . . . . . . . . . . . . . . . . . . . 48
8.4 Operating on the Region . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
8.5 Commands to Mark Textual Objects . . . . . . . . . . . . . . . . . . . . . . . . . . 48
8.6 The Mark Ring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
8.7 The Global Mark Ring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
9 Killing and Moving Text. . . . . . . . . . . . . . . . . . . . . . 51
9.1 Deletion and Killing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
9.1.1 Deletion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
9.1.2 Killing by Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
9.1.3 Other Kill Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
9.2 Yanking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
9.2.1 The Kill Ring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
9.2.2 Appending Kills. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
9.2.3 Yanking Earlier Kills . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
9.3 Accumulating Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
9.4 Rectangles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
9.5 CUA Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
v

10 Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
10.1 Saving Positions in Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
10.2 Saving Text in Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
10.3 Saving Rectangles in Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
10.4 Saving Window Configurations in Registers. . . . . . . . . . . . . . . . . . . 61
10.5 Keeping Numbers in Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
10.6 Keeping File Names in Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
10.7 Bookmarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
11 Controlling the Display . . . . . . . . . . . . . . . . . . . . . . 64
11.1 Scrolling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
11.2 Automatic Scrolling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
11.3 Horizontal Scrolling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
11.4 Follow Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
11.5 Using Multiple Typefaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
11.6 Standard Faces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
11.7 Font Lock mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
11.8 Interactive Highlighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
11.9 Window Fringes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
11.10 Displaying Boundaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
11.11 Useless Whitespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
11.12 Selective Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
11.13 Optional Mode Line Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
11.14 How Text Is Displayed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
11.15 Displaying the Cursor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
11.16 Truncation of Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
11.17 Customization of Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
12 Searching and Replacement . . . . . . . . . . . . . . . . . 80
12.1 Incremental Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
12.1.1 Basics of Incremental Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
12.1.2 Repeating Incremental Search . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

12.1.3 Errors in Incremental Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
12.1.4 Special Input for Incremental Search . . . . . . . . . . . . . . . . . . . . 82
12.1.5 Isearch for Non-ASCII Characters. . . . . . . . . . . . . . . . . . . . . . . . 82
12.1.6 Isearch Yanking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
12.1.7 Lazy Search Highlighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
12.1.8 Scrolling During Incremental Search . . . . . . . . . . . . . . . . . . . . . 83
12.1.9 Slow Terminal Incremental Search . . . . . . . . . . . . . . . . . . . . . . . 84
12.2 Nonincremental Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
12.3 Word Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
12.4 Regular Expression Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
12.5 Syntax of Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
12.6 Backslash in Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
12.7 Regular Expression Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
12.8 Searching and Case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
12.9 Replacement Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
vi
12.9.1 Unconditional Replacement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
12.9.2 Regexp Replacement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
12.9.3 Replace Commands and Case . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
12.9.4 Query Replace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
12.10 Other Search-and-Loop Commands . . . . . . . . . . . . . . . . . . . . . . . . . 95
13 Commands for Fixing Typos . . . . . . . . . . . . . . . . 97
13.1 Undo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
13.2 Killing Your Mistakes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
13.3 Transposing Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
13.4 Case Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
13.5 Checking and Correcting Spelling . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
14 Keyboard Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
14.1 Basic Use. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
14.2 The Keyboard Macro Ring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105

14.3 The Keyboard Macro Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
14.4 Executing Macros with Variations . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
14.5 Naming and Saving Keyboard Macros . . . . . . . . . . . . . . . . . . . . . . . 107
14.6 Editing a Keyboard Macro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
14.7 Stepwise Editing a Keyboard Macro. . . . . . . . . . . . . . . . . . . . . . . . . 109
15 File Handling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
15.1 File Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
15.2 Visiting Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
15.3 Saving Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
15.3.1 Commands for Saving Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
15.3.2 Backup Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
15.3.2.1 Numbered Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
15.3.2.2 Single or Numbered Backups . . . . . . . . . . . . . . . . . . . . . . 118
15.3.2.3 Automatic Deletion of Backups . . . . . . . . . . . . . . . . . . . . 118
15.3.2.4 Copying vs. Renaming . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
15.3.3 Customizing Saving of Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
15.3.4 Protection against Simultaneous Editing. . . . . . . . . . . . . . . . 120
15.3.5 Shadowing Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
15.3.6 Updating Time Stamps Automatically. . . . . . . . . . . . . . . . . . 122
15.4 Reverting a Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
15.5 Auto-Saving: Protection Against Disasters . . . . . . . . . . . . . . . . . . 123
15.5.1 Auto-Save Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
15.5.2 Controlling Auto-Saving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
15.5.3 Recovering Data from Auto-Saves . . . . . . . . . . . . . . . . . . . . . . 124
15.6 File Name Aliases. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
15.7 Version Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
15.7.1 Introduction to Version Control . . . . . . . . . . . . . . . . . . . . . . . . 126
15.7.1.1 Supported Version Control Systems. . . . . . . . . . . . . . . . 126
15.7.1.2 Concepts of Version Control . . . . . . . . . . . . . . . . . . . . . . . 127
15.7.1.3 Types of Log File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128

vii
15.7.2 Version Control and the Mode Line . . . . . . . . . . . . . . . . . . . . 128
15.7.3 Basic Editing under Version Control. . . . . . . . . . . . . . . . . . . . 128
15.7.3.1 Basic Version Control with Locking. . . . . . . . . . . . . . . . 129
15.7.3.2 Basic Version Control without Locking . . . . . . . . . . . . 129
15.7.3.3 Advanced Control in C-x v v . . . . . . . . . . . . . . . . . . . . . . 130
15.7.3.4 Features of the Log Entry Buffer . . . . . . . . . . . . . . . . . . 130
15.7.4 Examining And Comparing Old Versions . . . . . . . . . . . . . . . 131
15.7.5 The Secondary Commands of VC . . . . . . . . . . . . . . . . . . . . . . 132
15.7.5.1 Registering a File for Version Control. . . . . . . . . . . . . . 132
15.7.5.2 VC Status Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
15.7.5.3 Undoing Version Control Actions . . . . . . . . . . . . . . . . . . 134
15.7.6 Multiple Branches of a File. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
15.7.6.1 Switching between Branches. . . . . . . . . . . . . . . . . . . . . . . 135
15.7.6.2 Creating New Branches . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
15.7.6.3 Merging Branches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
15.7.6.4 Multi-User Branching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
15.8 File Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
15.9 Comparing Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
15.10 Diff Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
15.11 Miscellaneous File Operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
15.12 Accessing Compressed Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
15.13 File Archives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
15.14 Remote Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
15.15 Quoted File Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
15.16 File Name Cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
15.17 Convenience Features for Finding Files . . . . . . . . . . . . . . . . . . . . . 144
15.18 Filesets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
16 Using Multiple Buffers . . . . . . . . . . . . . . . . . . . . . 145
16.1 Creating and Selecting Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

16.2 Listing Existing Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
16.3 Miscellaneous Buffer Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
16.4 Killing Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
16.5 Operating on Several Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
16.6 Indirect Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
16.7 Convenience Features and Customization of Buffer Handling
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
16.7.1 Making Buffer Names Unique . . . . . . . . . . . . . . . . . . . . . . . . . . 152
16.7.2 Switching Between Buffers using Substrings . . . . . . . . . . . . 152
16.7.3 Customizing Buffer Menus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
viii
17 Multiple Windows . . . . . . . . . . . . . . . . . . . . . . . . . . 154
17.1 Concepts of Emacs Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
17.2 Splitting Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
17.3 Using Other Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
17.4 Displaying in Another Window. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
17.5 Forcing Display in the Same Window. . . . . . . . . . . . . . . . . . . . . . . . 156
17.6 Deleting and Rearranging Windows . . . . . . . . . . . . . . . . . . . . . . . . . 157
17.7 Window Handling Convenience Features and Customization
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
18 Frames and Graphical Displays . . . . . . . . . . . . 159
18.1 Killing and Yanking on Graphical Displays . . . . . . . . . . . . . . . . . . 159
18.1.1 Mouse Commands for Editing . . . . . . . . . . . . . . . . . . . . . . . . . . 159
18.1.2 Cut and Paste with Other Window Applications . . . . . . . . 161
18.1.3 Mouse Commands for Words and Lines. . . . . . . . . . . . . . . . . 161
18.1.4 Secondary Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
18.1.5 Using the Clipboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
18.2 Following References with the Mouse . . . . . . . . . . . . . . . . . . . . . . . . 162
18.3 Mouse Clicks for Menus. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
18.4 Mode Line Mouse Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164

18.5 Creating Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
18.6 Frame Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
18.7 Speedbar Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
18.8 Multiple Displays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
18.9 Special Buffer Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
18.10 Setting Frame Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
18.11 Scroll Bars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
18.12 Scrolling With “Wheeled” Mice . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
18.13 Drag and Drop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
18.14 Menu Bars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
18.15 Tool Bars. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
18.16 Using Dialog Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
18.17 Tooltips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
18.18 Mouse Avoidance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
18.19 Non-Window Terminals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
18.20 Using a Mouse in Terminal Emulators. . . . . . . . . . . . . . . . . . . . . . 172
19 International Character Set Support . . . . . . 173
19.1 Introduction to International Character Sets . . . . . . . . . . . . . . . . 173
19.2 Enabling Multibyte Characters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
19.3 Language Environments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
19.4 Input Methods. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
19.5 Selecting an Input Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
19.6 Unibyte and Multibyte Non-ASCII characters . . . . . . . . . . . . . . . . 179
19.7 Coding Systems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
19.8 Recognizing Coding Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
19.9 Specifying a File’s Coding System . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
ix
19.10 Choosing Coding Systems for Output . . . . . . . . . . . . . . . . . . . . . . 183
19.11 Specifying a Coding System for File Text . . . . . . . . . . . . . . . . . . 184
19.12 Coding Systems for Interprocess Communication . . . . . . . . . . . 185

19.13 Coding Systems for File Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
19.14 Coding Systems for Terminal I/O . . . . . . . . . . . . . . . . . . . . . . . . . . 187
19.15 Fontsets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
19.16 Defining fontsets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
19.17 Undisplayable Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
19.18 Unibyte Editing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
19.19 Charsets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
20 Major Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
20.1 How Major Modes are Chosen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
21 Indentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
21.1 Indentation Commands and Techniques . . . . . . . . . . . . . . . . . . . . . 196
21.2 Tab Stops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
21.3 Tabs vs. Spaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
22 Commands for Human Languages . . . . . . . . . 198
22.1 Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
22.2 Sentences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
22.3 Paragraphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
22.4 Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
22.5 Filling Text. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
22.5.1 Auto Fill Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
22.5.2 Explicit Fill Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
22.5.3 The Fill Prefix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
22.5.4 Adaptive Filling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
22.5.5 Refill Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
22.5.6 Long Lines Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
22.6 Case Conversion Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
22.7 Text Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
22.8 Outline Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
22.8.1 Format of Outlines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
22.8.2 Outline Motion Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210

22.8.3 Outline Visibility Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . 211
22.8.4 Viewing One Outline in Multiple Views . . . . . . . . . . . . . . . . 212
22.8.5 Folding Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
22.9 T
E
X Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
22.9.1 T
E
X Editing Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
22.9.2 LaT
E
X Editing Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
22.9.3 T
E
X Printing Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
22.9.4 T
E
X Mode Miscellany . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
22.10 SGML, XML, and HTML Modes . . . . . . . . . . . . . . . . . . . . . . . . . . 218
22.11 Nroff Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
22.12 Editing Formatted Text. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
x
22.12.1 Requesting to Edit Formatted Text . . . . . . . . . . . . . . . . . . . 220
22.12.2 Hard and Soft Newlines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
22.12.3 Editing Format Information . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
22.12.4 Faces in Formatted Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
22.12.5 Colors in Formatted Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
22.12.6 Indentation in Formatted Text . . . . . . . . . . . . . . . . . . . . . . . . 223
22.12.7 Justification in Formatted Text . . . . . . . . . . . . . . . . . . . . . . . 224
22.12.8 Setting Other Text Properties . . . . . . . . . . . . . . . . . . . . . . . . . 225

22.12.9 Forcing Enriched Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
22.13 Editing Text-based Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
22.13.1 What is a Text-based Table? . . . . . . . . . . . . . . . . . . . . . . . . . . 226
22.13.2 How to Create a Table? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
22.13.3 Table Recognition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
22.13.4 Commands for Table Cells . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
22.13.5 Cell Justification. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
22.13.6 Commands for Table Rows . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
22.13.7 Commands for Table Columns . . . . . . . . . . . . . . . . . . . . . . . . 229
22.13.8 Fix Width of Cells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
22.13.9 Conversion Between Plain Text and Tables . . . . . . . . . . . . 230
22.13.10 Analyzing Table Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . 231
22.13.11 Table Miscellany . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
23 Editing Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
23.1 Major Modes for Programming Languages . . . . . . . . . . . . . . . . . . 233
23.2 Top-Level Definitions, or Defuns . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
23.2.1 Left Margin Convention . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
23.2.2 Moving by Defuns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
23.2.3 Imenu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
23.2.4 Which Function Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
23.3 Indentation for Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
23.3.1 Basic Program Indentation Commands . . . . . . . . . . . . . . . . . 236
23.3.2 Indenting Several Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
23.3.3 Customizing Lisp Indentation . . . . . . . . . . . . . . . . . . . . . . . . . . 238
23.3.4 Commands for C Indentation. . . . . . . . . . . . . . . . . . . . . . . . . . . 238
23.3.5 Customizing C Indentation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
23.4 Commands for Editing with Parentheses . . . . . . . . . . . . . . . . . . . . 239
23.4.1 Expressions with Balanced Parentheses . . . . . . . . . . . . . . . . . 240
23.4.2 Moving in the Parenthesis Structure. . . . . . . . . . . . . . . . . . . . 241
23.4.3 Automatic Display Of Matching Parentheses . . . . . . . . . . . 241

23.5 Manipulating Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
23.5.1 Comment Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
23.5.2 Multiple Lines of Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
23.5.3 Options Controlling Comments. . . . . . . . . . . . . . . . . . . . . . . . . 244
23.6 Documentation Lookup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
23.6.1 Info Documentation Lookup. . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
23.6.2 Man Page Lookup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
23.6.3 Emacs Lisp Documentation Lookup . . . . . . . . . . . . . . . . . . . . 246
23.7 Hideshow minor mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
xi
23.8 Completion for Symbol Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
23.9 Glasses minor mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
23.10 Other Features Useful for Editing Programs . . . . . . . . . . . . . . . . 248
23.11 C and Related Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
23.11.1 C Mode Motion Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
23.11.2 Electric C Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
23.11.3 Hungry Delete Feature in C . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
23.11.4 Other Commands for C Mode . . . . . . . . . . . . . . . . . . . . . . . . . 251
23.12 Asm Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
24 Compiling and Testing Programs. . . . . . . . . . 254
24.1 Running Compilations under Emacs. . . . . . . . . . . . . . . . . . . . . . . . . 254
24.2 Compilation Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
24.3 Subshells for Compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
24.4 Searching with Grep under Emacs. . . . . . . . . . . . . . . . . . . . . . . . . . . 257
24.5 Finding Syntax Errors On The Fly . . . . . . . . . . . . . . . . . . . . . . . . . . 258
24.6 Running Debuggers Under Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
24.6.1 Starting GUD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
24.6.2 Debugger Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
24.6.3 Commands of GUD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
24.6.4 GUD Customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263

24.6.5 GDB Graphical Interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
24.6.5.1 GDB User Interface Layout . . . . . . . . . . . . . . . . . . . . . . . 264
24.6.5.2 Source Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
24.6.5.3 Breakpoints Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
24.6.5.4 Stack Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
24.6.5.5 Other Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
24.6.5.6 Watch Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
24.7 Executing Lisp Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
24.8 Libraries of Lisp Code for Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
24.9 Evaluating Emacs Lisp Expressions . . . . . . . . . . . . . . . . . . . . . . . . . 269
24.10 Lisp Interaction Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
24.11 Running an External Lisp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
25 Maintaining Large Programs. . . . . . . . . . . . . . . 272
25.1 Change Logs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
25.2 Format of ChangeLog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
25.3 Tags Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
25.3.1 Source File Tag Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
25.3.2 Creating Tags Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
25.3.3 Etags Regexps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
25.3.4 Selecting a Tags Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
25.3.5 Finding a Tag. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
25.3.6 Searching and Replacing with Tags Tables . . . . . . . . . . . . . . 280
25.3.7 Tags Table Inquiries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
xii
26 Abbrevs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
26.1 Abbrev Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
26.2 Defining Abbrevs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
26.3 Controlling Abbrev Expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
26.4 Examining and Editing Abbrevs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
26.5 Saving Abbrevs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285

26.6 Dynamic Abbrev Expansion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
26.7 Customizing Dynamic Abbreviation . . . . . . . . . . . . . . . . . . . . . . . . . 287
27 Sending Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
27.1 The Format of the Mail Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
27.2 Mail Header Fields. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
27.3 Mail Aliases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
27.4 Mail Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
27.4.1 Mail Sending. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
27.4.2 Mail Header Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
27.4.3 Citing Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
27.4.4 Mail Mode Miscellany . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
27.5 Mail Amusements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
27.6 Mail-Composition Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
28 Reading Mail with Rmail . . . . . . . . . . . . . . . . . . 297
28.1 Basic Concepts of Rmail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
28.2 Scrolling Within a Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
28.3 Moving Among Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
28.4 Deleting Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
28.5 Rmail Files and Inboxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
28.6 Multiple Rmail Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
28.7 Copying Messages Out to Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
28.8 Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
28.9 Rmail Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
28.10 Sending Replies. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
28.11 Summaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
28.11.1 Making Summaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
28.11.2 Editing in Summaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
28.12 Sorting the Rmail File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
28.13 Display of Messages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
28.14 Rmail and Coding Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310

28.15 Editing Within a Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
28.16 Digest Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
28.17 Converting an Rmail File to Inbox Format . . . . . . . . . . . . . . . . . 311
28.18 Reading Rot13 Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
28.19 movemail program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
28.20 Retrieving Mail from Remote Mailboxes. . . . . . . . . . . . . . . . . . . . 313
28.21 Retrieving Mail from Local Mailboxes in Various Formats . . 314
xiii
29 Dired, the Directory Editor . . . . . . . . . . . . . . . . 315
29.1 Entering Dired. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
29.2 Navigation in the Dired Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
29.3 Deleting Files with Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
29.4 Flagging Many Files at Once. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
29.5 Visiting Files in Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
29.6 Dired Marks vs. Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
29.7 Operating on Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
29.8 Shell Commands in Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
29.9 Transforming File Names in Dired . . . . . . . . . . . . . . . . . . . . . . . . . . 322
29.10 File Comparison with Dired. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
29.11 Subdirectories in Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
29.12 Moving Over Subdirectories. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
29.13 Hiding Subdirectories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
29.14 Updating the Dired Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
29.15 Dired and find . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
29.16 Editing the Dired Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
29.17 Viewing Image Thumbnails in Dired . . . . . . . . . . . . . . . . . . . . . . . 327
29.18 Other Dired Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
30 The Calendar and the Diary . . . . . . . . . . . . . . . 329
30.1 Movement in the Calendar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
30.1.1 Motion by Standard Lengths of Time. . . . . . . . . . . . . . . . . . . 329

30.1.2 Beginning or End of Week, Month or Year. . . . . . . . . . . . . . 330
30.1.3 Specified Dates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
30.2 Scrolling in the Calendar. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
30.3 Counting Days . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
30.4 Miscellaneous Calendar Commands . . . . . . . . . . . . . . . . . . . . . . . . . 331
30.5 Writing Calendar Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
30.6 Holidays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
30.7 Times of Sunrise and Sunset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
30.8 Phases of the Moon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
30.9 Conversion To and From Other Calendars . . . . . . . . . . . . . . . . . . . 336
30.9.1 Supported Calendar Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
30.9.2 Converting To Other Calendars . . . . . . . . . . . . . . . . . . . . . . . . 337
30.9.3 Converting From Other Calendars. . . . . . . . . . . . . . . . . . . . . . 338
30.9.4 Converting from the Mayan Calendar . . . . . . . . . . . . . . . . . . 339
30.10 The Diary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
30.10.1 Displaying the Diary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
30.10.2 The Diary File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
30.10.3 Date Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
30.10.4 Commands to Add to the Diary. . . . . . . . . . . . . . . . . . . . . . . 343
30.10.5 Special Diary Entries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344
30.11 Appointments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
30.12 Importing and Exporting Diary Entries . . . . . . . . . . . . . . . . . . . . 346
30.13 Daylight Saving Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
30.14 Summing Time Intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
xiv
31 Miscellaneous Commands . . . . . . . . . . . . . . . . . . 349
31.1 Gnus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
31.1.1 Gnus Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
31.1.2 When Gnus Starts Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
31.1.3 Summary of Gnus Commands . . . . . . . . . . . . . . . . . . . . . . . . . . 350

31.2 Running Shell Commands from Emacs . . . . . . . . . . . . . . . . . . . . . . 351
31.2.1 Single Shell Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
31.2.2 Interactive Inferior Shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
31.2.3 Shell Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
31.2.4 Shell Prompts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
31.2.5 Shell Command History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
31.2.5.1 Shell History Ring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
31.2.5.2 Shell History Copying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
31.2.5.3 Shell History References . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
31.2.6 Directory Tracking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
31.2.7 Shell Mode Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
31.2.8 Emacs Terminal Emulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
31.2.9 Term Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
31.2.10 Page-At-A-Time Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
31.2.11 Remote Host Shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
31.3 Using Emacs as a Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
31.3.1 Invoking emacsclient . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362
31.4 Printing Hard Copies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
31.5 PostScript Hardcopy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
31.6 Variables for PostScript Hardcopy. . . . . . . . . . . . . . . . . . . . . . . . . . . 364
31.7 Printing Package. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
31.8 Sorting Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
31.9 Narrowing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
31.10 Two-Column Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
31.11 Editing Binary Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
31.12 Saving Emacs Sessions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370
31.13 Recursive Editing Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
31.14 Emulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
31.15 Hyperlinking and Navigation Features. . . . . . . . . . . . . . . . . . . . . . 373
31.15.1 Following URLs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373

31.15.2 Activating URLs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373
31.15.3 Finding Files and URLs at Point . . . . . . . . . . . . . . . . . . . . . . 374
31.16 Dissociated Press . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
31.17 Other Amusements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
xv
32 Customization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
32.1 Minor Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
32.2 Easy Customization Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
32.2.1 Customization Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
32.2.2 Browsing and Searching for Options and Faces . . . . . . . . . 380
32.2.3 Changing a Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
32.2.4 Saving Customizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
32.2.5 Customizing Faces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384
32.2.6 Customizing Specific Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
32.2.7 Customization Themes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
32.3 Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
32.3.1 Examining and Setting Variables . . . . . . . . . . . . . . . . . . . . . . . 387
32.3.2 Hooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388
32.3.3 Local Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
32.3.4 Local Variables in Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390
32.3.4.1 Specifying File Variables . . . . . . . . . . . . . . . . . . . . . . . . . . 390
32.3.4.2 Safety of File Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392
32.4 Customizing Key Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
32.4.1 Keymaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
32.4.2 Prefix Keymaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
32.4.3 Local Keymaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
32.4.4 Minibuffer Keymaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
32.4.5 Changing Key Bindings Interactively . . . . . . . . . . . . . . . . . . . 396
32.4.6 Rebinding Keys in Your Init File . . . . . . . . . . . . . . . . . . . . . . . 397
32.4.7 Rebinding Function Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398

32.4.8 Named ASCII Control Characters . . . . . . . . . . . . . . . . . . . . . . 399
32.4.9 Rebinding Mouse Buttons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400
32.4.10 Disabling Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
32.5 The Syntax Table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
32.6 The Init File, ‘~/.emacs’. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
32.6.1 Init File Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
32.6.2 Init File Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
32.6.3 Terminal-specific Initialization. . . . . . . . . . . . . . . . . . . . . . . . . . 407
32.6.4 How Emacs Finds Your Init File . . . . . . . . . . . . . . . . . . . . . . . 407
32.6.5 Non-ASCII Characters in Init Files . . . . . . . . . . . . . . . . . . . . . 407
33 Dealing with Common Problems . . . . . . . . . . 409
33.1 Quitting and Aborting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
33.2 Dealing with Emacs Trouble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
33.2.1 If DEL Fails to Delete. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
33.2.2 Recursive Editing Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411
33.2.3 Garbage on the Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411
33.2.4 Garbage in the Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
33.2.5 Running out of Memory. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
33.2.6 Recovery After a Crash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
33.2.7 Emergency Escape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413
33.2.8 Help for Total Frustration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414
33.3 Reporting Bugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414
xvi
33.3.1 When Is There a Bug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414
33.3.2 Understanding Bug Reporting . . . . . . . . . . . . . . . . . . . . . . . . . . 415
33.3.3 Checklist for Bug Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416
33.3.4 Sending Patches for GNU Emacs . . . . . . . . . . . . . . . . . . . . . . . 420
33.4 Contributing to Emacs Development . . . . . . . . . . . . . . . . . . . . . . . . 422
33.5 How To Get Help with GNU Emacs . . . . . . . . . . . . . . . . . . . . . . . . . 422
Appendix A GNU GENERAL PUBLIC

LICENSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
Preamble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
MODIFICATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424
How to Apply These Terms to Your New Programs . . . . . . . . . . . . . . . . 428
Appendix B GNU Free Documentation License
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
ADDENDUM: How to use this License for your documents . . . . . . . . 435
Appendix C Command Line Arguments for
Emacs Invocation . . . . . . . . . . . . . . . . . . . . . . . . . . . 436
C.1 Action Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436
C.2 Initial Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437
C.3 Command Argument Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
C.4 Resuming Emacs with Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
C.5 Environment Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440
C.5.1 General Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440
C.5.2 Miscellaneous Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443
C.5.3 The MS-Windows System Registry. . . . . . . . . . . . . . . . . . . . . . 444
C.6 Specifying the Display Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445
C.7 Font Specification Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445
C.8 Window Color Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447
C.9 Options for Window Size and Position . . . . . . . . . . . . . . . . . . . . . . . 448
C.10 Internal and External Borders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450
C.11 Frame Titles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450
C.12 Icons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451
C.13 Other Display Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451
Appendix D X Options and Resources. . . . . . . 452
D.1 X Resources. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452
D.2 Table of X Resources for Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453
D.3 X Resources for Faces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454

D.4 Lucid Menu X Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455
D.5 GTK resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456
Appendix E Emacs 21 Antinews . . . . . . . . . . . . . 458
xvii
Appendix F Emacs and Mac OS . . . . . . . . . . . . . 462
F.1 Keyboard and Mouse Input on Mac . . . . . . . . . . . . . . . . . . . . . . . . . . 462
F.2 International Character Set Support on Mac . . . . . . . . . . . . . . . . . 463
F.3 Environment Variables and Command Line Arguments. . . . . . . 464
F.4 Volumes and Directories on Mac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464
F.5 Specifying Fonts on Mac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465
F.6 Mac-Specific Lisp Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466
Appendix G Emacs and Microsoft
Windows/MS-DOS . . . . . . . . . . . . . . . . . . . . . . . . . 467
G.1 Text Files and Binary Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467
G.2 File Names on MS-Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468
G.3 Emulation of ls on MS-Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469
G.4 HOME Directory on MS-Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . 469
G.5 Keyboard Usage on MS-Windows. . . . . . . . . . . . . . . . . . . . . . . . . . . . 469
G.6 Mouse Usage on MS-Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470
G.7 Subprocesses on Windows 9X/ME and Windows NT/2K/XP
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470
G.8 Printing and MS-Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
G.9 Miscellaneous Windows-specific features . . . . . . . . . . . . . . . . . . . . . 473
The GNU Manifesto . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474
What’s GNU? Gnu’s Not Unix! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474
Why I Must Write GNU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475
Why GNU Will Be Compatible with Unix . . . . . . . . . . . . . . . . . . . . . . . . . 475
How GNU Will Be Available . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475
Why Many Other Programmers Want to Help . . . . . . . . . . . . . . . . . . . . . 475
How You Can Contribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476

Why All Computer Users Will Benefit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476
Some Easily Rebutted Objections to GNU’s Goals . . . . . . . . . . . . . . . . . 477
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482
Key (Character) Index . . . . . . . . . . . . . . . . . . . . . . . . . . 504
Command and Function Index. . . . . . . . . . . . . . . . . . 512
Variable Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523
Concept Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529
Preface 1
Preface
This manual documents the use and simple customization of the Emacs editor. Simple
Emacs customizations do not require you to be a programmer, but if you are not interested
in customizing, you can ignore the customization hints.
This is primarily a reference manual, but can also be used as a primer. If you are new
to Emacs, we recommend you start with the on-line, learn-by-doing tutorial, before reading
the manual. To run the tutorial, start Emacs and type C-h t. The tutorial describes
commands, tells you when to try them, and explains the results.
On first reading, just skim chapters 1 and 2, which describe the notational conventions of
the manual and the general appearance of the Emacs display screen. Note which questions
are answered in these chapters, so you can refer back later. After reading chapter 4, you
should practice the commands shown there. The next few chapters describe fundamental
techniques and concepts that are used constantly. You need to understand them thoroughly,
so experiment with them until you are fluent.
Chapters 14 through 19 describe intermediate-level features that are useful for many
kinds of editing. Chapter 20 and following chapters describe optional but useful features;
read those chapters when you need them.
Read the Trouble chapter if Emacs does not seem to be working properly. It explains
how to cope with several common problems (see Section 33.2 [Lossage], page 410), as well
as when and how to report Emacs bugs (see Section 33.3 [Bugs], page 414).
To find the documentation of a particular command, look in the index. Keys (character
commands) and command names have separate indexes. There is also a glossary, with a

cross reference for each term.
This manual is available as a printed book and also as an Info file. The Info file is
for on-line perusal with the Info program, which is the principal means of accessing on-line
documentation in the GNU system. Both the Emacs Info file and an Info reader are included
with GNU Emacs. The Info file and the printed book contain substantially the same text
and are generated from the same source files, which are also distributed with GNU Emacs.
GNU Emacs is a member of the Emacs editor family. There are many Emacs
editors, all sharing common principles of organization. For information on the
underlying philosophy of Emacs and the lessons learned from its development, see
Emacs, the Extensible, Customizable Self-Documenting Display Editor, available from
/>This edition of the manual is intended for use with GNU Emacs installed on GNU and
Unix systems. GNU Emacs can also be used on VMS, MS-DOS (also called MS-DOG),
Microsoft Windows, and Macintosh systems. Those systems use different file name syntax;
in addition, VMS and MS-DOS do not support all GNU Emacs features. See Appendix G
[Microsoft Windows], page 467, for information about using Emacs on Windows. See Ap-
pendix F [Mac OS], page 462, for information about using Emacs on Macintosh. We don’t
try to describe VMS usage in this manual.
Distribution 2
Distribution
GNU Emacs is free software; this means that everyone is free to use it and free to redistribute
it on certain conditions. GNU Emacs is not in the public domain; it is copyrighted and there
are restrictions on its distribution, but these restrictions are designed to permit everything
that a good cooperating citizen would want to do. What is not allowed is to try to prevent
others from further sharing any version of GNU Emacs that they might get from you. The
precise conditions are found in the GNU General Public License that comes with Emacs
and also appears in this manual
1
. See Appendix A [Copying], page 423.
One way to get a copy of GNU Emacs is from someone else who has it. You need not
ask for our permission to do so, or tell any one else; just copy it. If you have access to the

Internet, you can get the latest distribution version of GNU Emacs by anonymous FTP;
see on our website for more information.
You may also receive GNU Emacs when you buy a computer. Computer manufacturers
are free to distribute copies on the same terms that apply to everyone else. These terms
require them to give you the full sources, including whatever changes they may have made,
and to permit you to redistribute the GNU Emacs received from them under the usual
terms of the General Public License. In other words, the program must be free for you
when you get it, not just free for the manufacturer.
You can also order copies of GNU Emacs from the Free Software Foundation. This
is a convenient and reliable way to get a copy; it is also a good way to help fund our
work. We also sell hardcopy versions of this manual and An Introduction to Programming
in Emacs Lisp, by Robert J. Chassell. You can find an order form on our web site at
For further information, write to
Free Software Foundation
51 Franklin Street, Fifth Floor
Boston, MA 02110-1301
USA
The income from distribution fees goes to support the foundation’s purpose: the devel-
opment of new free software, and improvements to our existing programs including GNU
Emacs.
If you find GNU Emacs useful, please send a donation to the Free Software Foundation
to support our work. Donations to the Free Software Foundation are tax deductible in the
US. If you use GNU Emacs at your workplace, please suggest that the company make a
donation. If company policy is unsympathetic to the idea of donating to charity, you might
instead suggest ordering a CD-ROM from the Foundation occasionally, or subscribing to
periodic updates.
Acknowledgments
Contributors to GNU Emacs include Jari Aalto, Per Abrahamsen, Tomas Abrahamsson,
Jay K. Adams, Michael Albinus, Nagy Andras, Ralf Angeli, Joe Arceneaux, Miles Bader,
1

This manual is itself covered by the GNU Free Documentation License. This license is similar in spirit
to the General Public License, but is more suitable for documentation. See Appendix B [GNU Free
Documentation License], page 429.
Distribution 3
David Bakhash, Juanma Barranquero, Eli Barzilay, Steven L. Baur, Jay Belanger, Alexan-
der L. Belikoff, Boaz Ben-Zvi, Karl Berry, Anna M. Bigatti, Ray Blaak, Jim Blandy, Johan
Bockg˚ard, Per Bothner, Terrence Brannon, Frank Bresz, Peter Breton, Emmanuel Briot,
Kevin Broadey, Vincent Broman, David M. Brown, Georges Brun-Cottan, Joe Buehler,
Wlodek Bzyl, Bill Carpenter, Per Cederqvist, Hans Chalupsky, Chris Chase, Bob Chassell,
Andrew Choi, Sacha Chua, James Clark, Mike Clarkson, Glynn Clements, Andrew Csillag,
Doug Cutting, Mathias Dahl, Satyaki Das, Michael DeCorte, Gary Delp, Matthieu Devin,
Eri Ding, Jan Dj¨arv, Carsten Dominik, Scott Draves, Benjamin Drieu, Viktor Dukhovni,
John Eaton, Rolf Ebert, Paul Eggert, Stephen Eglen, Torbj¨orn Einarsson, Tsugutomo
Enami, Hans Henrik Eriksen, Michael Ernst, Ata Etemadi, Frederick Farnbach, Oscar
Figueiredo, Fred Fish, Karl Fogel, Gary Foster, Romain Francoise, Noah Friedman, An-
dreas Fuchs, Hallvard Furuseth, Keith Gabryelski, Peter S. Galbraith, Kevin Gallagher,
Kevin Gallo, Juan Le´on Lahoz Garc´ıa, Howard Gayle, Stephen Gildea, Julien Gilles, David
Gillespie, Bob Glickstein, Deepak Goel, Boris Goldowsky, Michelangelo Grigni, Odd Gripen-
stam, Kai Großjohann, Michael Gschwind, Henry Guillaume, Doug Gwyn, Ken’ichi Handa,
Lars Hansen, Chris Hanson, K. Shane Hartman, John Heidemann, Jon K. Hellan, Jes-
per Harder, Markus Heritsch, Karl Heuer, Manabu Higashida, Anders Holst, Jeffrey C.
Honig, Kurt Hornik, Tom Houlder, Joakim Hove, Denis Howe, Lars Ingebrigtsen, Andrew
Innes, Seiichiro Inoue, Pavel Janik, Paul Jarc, Ulf Jasper, Michael K. Johnson, Kyle Jones,
Terry Jones, Simon Josefsson, Arne Jørgensen, Tomoji Kagatani, Brewster Kahle, Lute
Kamstra, David Kastrup, David Kaufman, Henry Kautz, Taichi Kawabata, Howard Kaye,
Michael Kifer, Richard King, Peter Kleiweg, Shuhei Kobayashi, Pavel Kobiakov, Larry K.
Kolodney, David M. Koppelman, Koseki Yoshinori, Robert Krawitz, Sebastian Kremer,
Ryszard Kubiak, Geoff Kuenning, David K˚agedal, Daniel LaLiberte, Mario Lang, Aaron
Larson, James R. Larus, Vinicius Jose Latorre, Werner Lemberg, Frederic Lepied, Peter
Liljenberg, Lars Lindberg, Chris Lindblad, Anders Lindgren, Thomas Link, Juri Linkov,

Francis Litterio, Emilio C. Lopes, Dave Love, Sascha L¨udecke, Eric Ludlam,Alan Macken-
zie, Christopher J. Madsen, Neil M. Mager, Ken Manheimer, Bill Mann, Brian Marick,
Simon Marshall, Bengt Martensson, Charlie Martin, Thomas May, Roland McGrath, Will
Mengarini, David Megginson, Ben A. Mesander, Wayne Mesard, Brad Miller, Lawrence
Mitchell, Richard Mlynarik, Gerd Moellmann, Stefan Monnier, Morioka Tomohiko, Keith
Moore, Glenn Morris, Diane Murray, Sen Nagata, Erik Naggum, Thomas Neumann, Thien-
Thi Nguyen, Mike Newton, Jurgen Nickelsen, Dan Nicolaescu, Hrvoje Niksic, Jeff Norden,
Andrew Norman, Alexandre Oliva, Bob Olson, Michael Olson, Takaaki Ota, Pieter E. J.
Pareit, David Pearson, Jeff Peck, Damon Anton Permezel, Tom Perrine, William M. Perry,
Per Persson, Jens Petersen, Daniel Pfeiffer, Richard L. Pieri, Fred Pierresteguy, Christian
Plaunt, David Ponce, Francesco A. Potorti, Michael D. Prange, Mukesh Prasad, Ken Rae-
burn, Marko Rahamaa, Ashwin Ram, Eric S. Raymond, Paul Reilly, Edward M. Reingold,
Alex Rezinsky, Rob Riepel, David Reitter, Nick Roberts, Roland B. Roberts, John Robin-
son, Danny Roozendaal, William Rosenblatt, Guillermo J. Rozas, Martin Rudalics, Ivar
Rummelhoff, Jason Rumney, Wolfgang Rupprecht, Kevin Ryde, James B. Salem, Masahiko
Sato, Jorgen Schaefer, Holger Schauer, William Schelter, Ralph Schleicher, Gregor Schmid,
Michael Schmidt, Ronald S. Schnell, Philippe Schnoebelen, Jan Schormann, Alex Schroeder,
Stephen Schoef, Raymond Scholz, Randal Schwartz, Oliver Seidel, Manuel Serrano, Ho-
vav Shacham, Stanislav Shalunov, Marc Shapiro, Richard Sharman, Olin Shivers, Espen
Skoglund, Rick Sladkey, Lynn Slater, Chris Smith, David Smith, Paul D. Smith, Andre
Spiegel, Michael Staats, William Sommerfeld, Michael Staats, Reiner Steib, Sam Steingold,
Distribution 4
Ake Stenhoff, Peter Stephenson, Ken Stevens, Jonathan Stigelman, Martin Stjernholm, Kim
F. Storm, Steve Strassman, Olaf Sylvester, Naoto Takahashi, Steven Tamm, Jean-Philippe
Theberge, Jens T. Berger Thielemann, Spencer Thomas, Jim Thompson, Luc Teirlinck,
Tom Tromey, Enami Tsugutomo, Eli Tziperman, Daiki Ueno, Masanobu Umeda, Rajesh
Vaidheeswarran, Neil W. Van Dyke, Didier Verna, Ulrik Vieth, Geoffrey Voelker, Johan
Vromans, Inge Wallin, John Paul Wallington, Colin Walters, Barry Warsaw, Morten Welin-
der, Joseph Brian Wells, Rodney Whitby, John Wiegley, Ed Wilkinson, Mike Williams, Bill
Wohler, Steven A. Wood, Dale R. Worley, Francis J. Wright, Felix S. T. Wu, Tom Wurgler,

Katsumi Yamaoka, Masatake Yamato, Jonathan Yavner, Ryan Yeske, Chong Yidong, Ilya
Zakharevich, Milan Zamazal, Victor Zandy, Eli Zaretskii, Jamie Zawinski, Shenghuo Zhu,
Ian T. Zimmermann, Reto Zimmermann, Neal Ziring, Teodor Zlatanov, and Detlev Zundel.

Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×