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

GNU 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 (2.4 MB, 611 trang )

GNU Emacs Manual



GNU Emacs Manual

Seventeenth Edition, Updated for Emacs Version 24.5.

Richard Stallman et al.


This is the Seventeenth edition of the GNU Emacs Manual,
updated for Emacs version 24.5.
Copyright c 1985–1987, 1993–2015 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.3 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 the freedom to copy and modify
this GNU manual. Buying copies from the FSF supports it in developing GNU
and promoting software freedom.”

Published by the Free Software Foundation
51 Franklin Street, Fifth Floor
Boston, MA 02110-1301 USA
ISBN 978-0-9831592-5-4

Cover art by Etienne Suvasa; cover design by Matt Lee.




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 . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4 Basic Editing Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5 The Minibuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
6 Running Commands by Name . . . . . . . . . . . . . . . . . . . . . . . . . . 36
7 Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
8 The Mark and the Region . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
9 Killing and Moving Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
10 Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
11 Controlling the Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
12 Searching and Replacement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
13 Commands for Fixing Typos . . . . . . . . . . . . . . . . . . . . . . . . . . 109
14 Keyboard Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
15 File Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
16 Using Multiple Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
17 Multiple Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
18 Frames and Graphical Displays . . . . . . . . . . . . . . . . . . . . . . . . 162
19 International Character Set Support . . . . . . . . . . . . . . . . . . . . 177
20 Major and Minor Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
21 Indentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
22 Commands for Human Languages . . . . . . . . . . . . . . . . . . . . . . 208

23 Editing Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
24 Compiling and Testing Programs . . . . . . . . . . . . . . . . . . . . . . . 261
25 Maintaining Large Programs . . . . . . . . . . . . . . . . . . . . . . . . . . 281
26 Abbrevs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
27 Dired, the Directory Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
28 The Calendar and the Diary . . . . . . . . . . . . . . . . . . . . . . . . . . 331
29 Sending Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
30 Reading Mail with Rmail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
31 Miscellaneous Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
32 Emacs Lisp Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408


ii
33 Customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34 Dealing with Common Problems . . . . . . . . . . . . . . . . . . . . . . .
A GNU GENERAL PUBLIC LICENSE . . . . . . . . . . . . . . . . . . .
B GNU Free Documentation License . . . . . . . . . . . . . . . . . . . . . .
C Command Line Arguments for Emacs Invocation . . . . . . . . . .
D X Options and Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E Emacs 23 Antinews . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
F Emacs and Mac OS / GNUstep . . . . . . . . . . . . . . . . . . . . . . . .
G Emacs and Microsoft Windows/MS-DOS . . . . . . . . . . . . . . . .
The GNU Manifesto . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Key (Character) Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Command and Function Index . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Variable Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Concept Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

412

443
459
470
478
493
500
502
505
515
523
546
555
568
575


iii

Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1

The Organization of the Screen . . . . . . . . . . . . . . . 6
1.1
1.2
1.3

1.4

2

Kinds of User Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Keys and Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

Entering and Exiting Emacs . . . . . . . . . . . . . . . . . . 14
3.1
3.2

4

6
7
8
9

Characters, Keys and Commands . . . . . . . . . . . . 11
2.1
2.2
2.3

3

Point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The Echo Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The Mode Line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The Menu Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


Entering Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Exiting Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

Basic Editing Commands . . . . . . . . . . . . . . . . . . . . . 16
4.1
4.2
4.3
4.4
4.5
4.6
4.7
4.8
4.9
4.10
4.11

Inserting Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Changing the Location of Point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Erasing Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Undoing Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Blank Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Continuation Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Cursor Position Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Numeric Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Repeating a Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

16

17
19
20
20
21
21
22
22
23
25


iv

5

The Minibuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
5.1
5.2
5.3
5.4

Using the Minibuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Minibuffers for File Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Editing in the Minibuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Completion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.1 Completion Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.2 Completion Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.3 Completion Exit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.4 How Completion Alternatives Are Chosen . . . . . . . . . . . . . . . .

5.4.5 Completion Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.5 Minibuffer History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.6 Repeating Minibuffer Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.7 Entering passwords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.8 Yes or No Prompts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

26
26
27
28
28
29
30
31
32
32
34
34
35

6

Running Commands by Name . . . . . . . . . . . . . . . 36

7

Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
7.1
7.2
7.3

7.4
7.5
7.6
7.7
7.8
7.9

8

Documentation for a Key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Help by Command or Variable Name . . . . . . . . . . . . . . . . . . . . . . . . . .
Apropos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Help Mode Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Keyword Search for Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Help for International Language Support . . . . . . . . . . . . . . . . . . . . . .
Other Help Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Help Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Help on Active Text and Tooltips . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

39
39
40
41
42
42
43
43
44

The Mark and the Region . . . . . . . . . . . . . . . . . . . . 45

8.1
8.2
8.3
8.4
8.5
8.6
8.7

Setting the Mark . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Commands to Mark Textual Objects . . . . . . . . . . . . . . . . . . . . . . . . . .
Operating on the Region . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The Mark Ring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The Global Mark Ring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Shift Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Disabling Transient Mark Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

45
47
47
48
49
49
50


v

9

Killing and Moving Text . . . . . . . . . . . . . . . . . . . . . . 52

9.1

Deletion and Killing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.1.1 Deletion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.1.2 Killing by Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.1.3 Other Kill Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.1.4 Options for Killing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2 Yanking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2.1 The Kill Ring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2.2 Yanking Earlier Kills . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2.3 Appending Kills . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.3 “Cut and Paste” Operations on Graphical Displays . . . . . . . . . . . .
9.3.1 Using the Clipboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.3.2 Cut and Paste with Other Window Applications . . . . . . . . . .
9.3.3 Secondary Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.4 Accumulating Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.5 Rectangles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.6 CUA Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10

Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

10.1
10.2
10.3
10.4
10.5
10.6
10.7

10.8

11

52
52
53
54
54
55
55
55
56
57
57
58
58
59
60
62

Saving Positions in Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Saving Text in Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Saving Rectangles in Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Saving Window Configurations in Registers . . . . . . . . . . . . . . . . . . .
Keeping Numbers in Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Keeping File Names in Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Keyboard Macro Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Bookmarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


64
64
65
66
66
66
67
67

Controlling the Display . . . . . . . . . . . . . . . . . . . . . . 69

11.1
11.2
11.3
11.4
11.5
11.6
11.7
11.8
11.9
11.10
11.11
11.12
11.13
11.14
11.15
11.16
11.17
11.18


Scrolling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Recentering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Automatic Scrolling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Horizontal Scrolling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Narrowing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
View Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Follow Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Text Faces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Colors for Faces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Standard Faces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Text Scale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Font Lock mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Interactive Highlighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Window Fringes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Displaying Boundaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Useless Whitespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Selective Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Optional Mode Line Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

69
70
71
72
73
73
74
74
75
75
78

78
80
81
82
82
83
84


vi
11.19
11.20
11.21
11.22
11.23

12

How Text Is Displayed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Displaying the Cursor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Line Truncation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Visual Line Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Customization of Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

85
86
87
87
88


Searching and Replacement . . . . . . . . . . . . . . . . . 90

12.1 Incremental Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
12.1.1 Basics of Incremental Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
12.1.2 Repeating Incremental Search . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
12.1.3 Errors in Incremental Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
12.1.4 Special Input for Incremental Search . . . . . . . . . . . . . . . . . . . . 92
12.1.5 Isearch Yanking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
12.1.6 Not Exiting Incremental Search . . . . . . . . . . . . . . . . . . . . . . . . . 93
12.1.7 Searching the Minibuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
12.2 Nonincremental Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
12.3 Word Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
12.4 Symbol Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
12.5 Regular Expression Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
12.6 Syntax of Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
12.7 Backslash in Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
12.8 Regular Expression Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
12.9 Searching and Case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
12.10 Replacement Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
12.10.1 Unconditional Replacement . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
12.10.2 Regexp Replacement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
12.10.3 Replace Commands and Case . . . . . . . . . . . . . . . . . . . . . . . . . 104
12.10.4 Query Replace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
12.11 Other Search-and-Loop Commands . . . . . . . . . . . . . . . . . . . . . . . . 107

13

Commands for Fixing Typos . . . . . . . . . . . . . . . 109

13.1

13.2
13.3
13.4

14

Undo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Transposing Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Case Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Checking and Correcting Spelling . . . . . . . . . . . . . . . . . . . . . . . . . . .

109
110
111
111

Keyboard Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . 114

14.1
14.2
14.3
14.4
14.5
14.6
14.7

Basic Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The Keyboard Macro Ring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The Keyboard Macro Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Executing Macros with Variations . . . . . . . . . . . . . . . . . . . . . . . . . . .

Naming and Saving Keyboard Macros . . . . . . . . . . . . . . . . . . . . . . .
Editing a Keyboard Macro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Stepwise Editing a Keyboard Macro . . . . . . . . . . . . . . . . . . . . . . . . .

114
115
116
118
118
119
120


vii

15

File Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122

15.1 File Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.2 Visiting Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.3 Saving Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.3.1 Commands for Saving Files . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.3.2 Backup Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.3.2.1 Single or Numbered Backups . . . . . . . . . . . . . . . . . . . . . .
15.3.2.2 Automatic Deletion of Backups . . . . . . . . . . . . . . . . . . . .
15.3.2.3 Copying vs. Renaming . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.3.3 Customizing Saving of Files . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.3.4 Protection against Simultaneous Editing. . . . . . . . . . . . . . . .
15.3.5 Shadowing Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

15.3.6 Updating Time Stamps Automatically. . . . . . . . . . . . . . . . . .
15.4 Reverting a Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.5 Auto-Saving: Protection Against Disasters . . . . . . . . . . . . . . . . . .
15.5.1 Auto-Save Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.5.2 Controlling Auto-Saving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.5.3 Recovering Data from Auto-Saves . . . . . . . . . . . . . . . . . . . . . .
15.6 File Name Aliases. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.7 File Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.8 Comparing Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.9 Diff Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.10 Miscellaneous File Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.11 Accessing Compressed Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.12 File Archives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.13 Remote Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.14 Quoted File Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.15 File Name Cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15.16 Convenience Features for Finding Files . . . . . . . . . . . . . . . . . . . . .
15.17 Filesets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

16

122
123
126
126
127
128
129
129
130

130
131
132
132
133
133
134
135
135
136
137
138
140
141
141
142
143
144
144
145

Using Multiple Buffers . . . . . . . . . . . . . . . . . . . . . 147

16.1
16.2
16.3
16.4
16.5
16.6
16.7


Creating and Selecting Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Listing Existing Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Miscellaneous Buffer Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Killing Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Operating on Several Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Indirect Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Convenience Features and Customization of Buffer Handling
..............................................................
16.7.1 Making Buffer Names Unique . . . . . . . . . . . . . . . . . . . . . . . . . .
16.7.2 Fast minibuffer selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16.7.3 Customizing Buffer Menus . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

147
149
149
150
151
153
153
154
154
155


viii

17

Multiple Windows . . . . . . . . . . . . . . . . . . . . . . . . . . 156


17.1 Concepts of Emacs Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.2 Splitting Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.3 Using Other Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.4 Displaying in Another Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.5 Deleting and Rearranging Windows . . . . . . . . . . . . . . . . . . . . . . . . .
17.6 Displaying a Buffer in a Window . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.6.1 How display-buffer works . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.7 Convenience Features for Window Handling . . . . . . . . . . . . . . . . .

18

Frames and Graphical Displays . . . . . . . . . . . . 162

18.1
18.2
18.3
18.4
18.5
18.6
18.7
18.8
18.9
18.10
18.11
18.12
18.13
18.14
18.15
18.16

18.17
18.18
18.19
18.20

19

156
156
157
158
159
160
160
161

Mouse Commands for Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Mouse Commands for Words and Lines . . . . . . . . . . . . . . . . . . . . .
Following References with the Mouse . . . . . . . . . . . . . . . . . . . . . . . .
Mouse Clicks for Menus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Mode Line Mouse Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Creating Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Frame Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Speedbar Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Multiple Displays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Frame Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Scroll Bars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Drag and Drop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Menu Bars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Tool Bars. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using Dialog Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Tooltips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Mouse Avoidance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Non-Window Terminals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using a Mouse in Text Terminals . . . . . . . . . . . . . . . . . . . . . . . . . .

162
164
164
165
165
166
167
168
171
171
172
172
173
173
173
174
174
175
175
176

International Character Set Support . . . . . . 177


19.1
19.2
19.3
19.4
19.5
19.6
19.7
19.8
19.9
19.10
19.11
19.12
19.13
19.14

Introduction to International Character Sets . . . . . . . . . . . . . . . .
Language Environments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Input Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Selecting an Input Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Coding Systems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Recognizing Coding Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Specifying a File’s Coding System . . . . . . . . . . . . . . . . . . . . . . . . . . .
Choosing Coding Systems for Output . . . . . . . . . . . . . . . . . . . . . . .
Specifying a Coding System for File Text. . . . . . . . . . . . . . . . . . . .
Coding Systems for Interprocess Communication . . . . . . . . . . .
Coding Systems for File Names . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Coding Systems for Terminal I/O . . . . . . . . . . . . . . . . . . . . . . . . . .
Fontsets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Defining fontsets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


177
179
181
182
183
185
187
187
188
189
190
191
192
192


ix
19.15
19.16
19.17
19.18
19.19

20

Major Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Minor Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
Choosing File Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202

Indentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205


21.1
21.2
21.3
21.4

22

194
195
195
196
197

Major and Minor Modes . . . . . . . . . . . . . . . . . . . 199

20.1
20.2
20.3

21

Modifying Fontsets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Undisplayable Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Unibyte Editing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Charsets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Bidirectional Editing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Indentation Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Tab Stops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Tabs vs. Spaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Convenience Features for Indentation . . . . . . . . . . . . . . . . . . . . . . .

205
206
207
207

Commands for Human Languages . . . . . . . . . 208

22.1 Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.2 Sentences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.3 Paragraphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.4 Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.5 Filling Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.5.1 Auto Fill Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.5.2 Explicit Fill Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.5.3 The Fill Prefix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.5.4 Adaptive Filling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.6 Case Conversion Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.7 Text Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.8 Outline Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.8.1 Format of Outlines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.8.2 Outline Motion Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.8.3 Outline Visibility Commands . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.8.4 Viewing One Outline in Multiple Views . . . . . . . . . . . . . . . .
22.8.5 Folding Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.9 Org Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.9.1 Org as an organizer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.9.2 Org as an authoring system . . . . . . . . . . . . . . . . . . . . . . . . . . . .

22.10 TEX Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.10.1 TEX Editing Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.10.2 LATEX Editing Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.10.3 TEX Printing Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.10.4 TEX Mode Miscellany . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.11 SGML and HTML Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.12 Nroff Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.13 Enriched Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.13.1 Enriched Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

208
209
210
211
212
212
213
214
215
216
217
217
218
219
219
221
221
222
223
223

224
224
225
226
228
228
229
230
230


x
22.13.2 Hard and Soft Newlines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.13.3 Editing Format Information . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.13.4 Faces in Enriched Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.13.5 Indentation in Enriched Text . . . . . . . . . . . . . . . . . . . . . . . . . .
22.13.6 Justification in Enriched Text . . . . . . . . . . . . . . . . . . . . . . . . .
22.13.7 Setting Other Text Properties . . . . . . . . . . . . . . . . . . . . . . . . .
22.14 Editing Text-based Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.14.1 What is a Text-based Table? . . . . . . . . . . . . . . . . . . . . . . . . . .
22.14.2 Creating a Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.14.3 Table Recognition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.14.4 Commands for Table Cells . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.14.5 Cell Justification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.14.6 Table Rows and Columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.14.7 Converting Between Plain Text and Tables . . . . . . . . . . . .
22.14.8 Table Miscellany . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.15 Two-Column Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

23


230
231
231
232
233
233
233
234
234
234
235
236
236
236
237
238

Editing Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . 240

23.1 Major Modes for Programming Languages . . . . . . . . . . . . . . . . . .
23.2 Top-Level Definitions, or Defuns . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.2.1 Left Margin Convention . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.2.2 Moving by Defuns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.2.3 Imenu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.2.4 Which Function Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.3 Indentation for Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.3.1 Basic Program Indentation Commands . . . . . . . . . . . . . . . . .
23.3.2 Indenting Several Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.3.3 Customizing Lisp Indentation . . . . . . . . . . . . . . . . . . . . . . . . . .

23.3.4 Commands for C Indentation. . . . . . . . . . . . . . . . . . . . . . . . . . .
23.3.5 Customizing C Indentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.4 Commands for Editing with Parentheses . . . . . . . . . . . . . . . . . . . .
23.4.1 Expressions with Balanced Parentheses . . . . . . . . . . . . . . . . .
23.4.2 Moving in the Parenthesis Structure . . . . . . . . . . . . . . . . . . . .
23.4.3 Matching Parentheses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.5 Manipulating Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.5.1 Comment Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.5.2 Multiple Lines of Comments . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.5.3 Options Controlling Comments . . . . . . . . . . . . . . . . . . . . . . . . .
23.6 Documentation Lookup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.6.1 Info Documentation Lookup . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.6.2 Man Page Lookup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.6.3 Emacs Lisp Documentation Lookup . . . . . . . . . . . . . . . . . . . .
23.7 Hideshow minor mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.8 Completion for Symbol Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.9 MixedCase Words. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.10 Semantic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.11 Other Features Useful for Editing Programs . . . . . . . . . . . . . . . .
23.12 C and Related Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

240
241
241
241
242
243
243
243
244

244
245
245
246
246
248
248
249
249
251
251
252
252
252
253
253
254
255
255
256
256


xi
23.12.1 C Mode Motion Commands . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.12.2 Electric C Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.12.3 Hungry Delete Feature in C . . . . . . . . . . . . . . . . . . . . . . . . . . .
23.12.4 Other Commands for C Mode . . . . . . . . . . . . . . . . . . . . . . . . .
23.13 Asm Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


24

Compiling and Testing Programs . . . . . . . . . . 261

24.1 Running Compilations under Emacs. . . . . . . . . . . . . . . . . . . . . . . . .
24.2 Compilation Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.3 Subshells for Compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.4 Searching with Grep under Emacs. . . . . . . . . . . . . . . . . . . . . . . . . . .
24.5 Finding Syntax Errors On The Fly . . . . . . . . . . . . . . . . . . . . . . . . . .
24.6 Running Debuggers Under Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.6.1 Starting GUD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.6.2 Debugger Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.6.3 Commands of GUD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.6.4 GUD Customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.6.5 GDB Graphical Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.6.5.1 GDB User Interface Layout . . . . . . . . . . . . . . . . . . . . . . .
24.6.5.2 Source Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.6.5.3 Breakpoints Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.6.5.4 Threads Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.6.5.5 Stack Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.6.5.6 Other GDB Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.6.5.7 Watch Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.6.5.8 Multithreaded Debugging . . . . . . . . . . . . . . . . . . . . . . . . .
24.7 Executing Lisp Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.8 Libraries of Lisp Code for Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.9 Evaluating Emacs Lisp Expressions . . . . . . . . . . . . . . . . . . . . . . . . .
24.10 Lisp Interaction Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.11 Running an External Lisp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

25


256
257
258
258
260

261
262
264
264
266
266
266
267
268
270
270
271
271
272
272
273
273
274
275
276
276
278
279

279

Maintaining Large Programs. . . . . . . . . . . . . . . 281

25.1 Version Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25.1.1 Introduction to Version Control . . . . . . . . . . . . . . . . . . . . . . . .
25.1.1.1 Understanding the problems it addresses . . . . . . . . . .
25.1.1.2 Supported Version Control Systems. . . . . . . . . . . . . . . .
25.1.1.3 Concepts of Version Control . . . . . . . . . . . . . . . . . . . . . . .
25.1.1.4 Merge-based vs lock-based Version Control . . . . . . . .
25.1.1.5 Changeset-based vs File-based Version Control . . . .
25.1.1.6 Decentralized vs Centralized Repositories . . . . . . . . . .
25.1.1.7 Types of Log File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25.1.2 Version Control and the Mode Line . . . . . . . . . . . . . . . . . . . .
25.1.3 Basic Editing under Version Control . . . . . . . . . . . . . . . . . . . .
25.1.3.1 Basic Version Control with Merging . . . . . . . . . . . . . . .
25.1.3.2 Basic Version Control with Locking . . . . . . . . . . . . . . . .
25.1.3.3 Advanced Control in C-x v v . . . . . . . . . . . . . . . . . . . . . .
25.1.4 Features of the Log Entry Buffer . . . . . . . . . . . . . . . . . . . . . . .

281
281
281
281
282
283
283
284
284
284

285
285
286
287
287


xii
25.1.5 Registering a File for Version Control . . . . . . . . . . . . . . . . . .
25.1.6 Examining And Comparing Old Revisions . . . . . . . . . . . . . .
25.1.7 VC Change Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25.1.8 Undoing Version Control Actions . . . . . . . . . . . . . . . . . . . . . . .
25.1.9 Ignore Version Control Files . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25.1.10 VC Directory Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25.1.10.1 The VC Directory Buffer . . . . . . . . . . . . . . . . . . . . . . . . .
25.1.10.2 VC Directory Commands . . . . . . . . . . . . . . . . . . . . . . . .
25.1.11 Version Control Branches . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25.1.11.1 Switching between Branches . . . . . . . . . . . . . . . . . . . . . .
25.1.11.2 Pulling Changes into a Branch . . . . . . . . . . . . . . . . . . .
25.1.11.3 Merging Branches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25.1.11.4 Creating New Branches . . . . . . . . . . . . . . . . . . . . . . . . . .
25.2 Change Logs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25.2.1 Change Log Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25.2.2 Format of ChangeLog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25.3 Tags Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25.3.1 Source File Tag Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25.3.2 Creating Tags Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25.3.3 Etags Regexps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25.3.4 Selecting a Tags Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25.3.5 Finding a Tag. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

25.3.6 Searching and Replacing with Tags Tables . . . . . . . . . . . . . .
25.3.7 Tags Table Inquiries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25.4 Emacs Development Environment . . . . . . . . . . . . . . . . . . . . . . . . . . .

26

Abbrevs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309

26.1
26.2
26.3
26.4
26.5
26.6
26.7

27

288
289
290
292
292
292
293
293
295
295
296
296

297
297
297
298
299
299
301
302
304
304
306
307
307

Abbrev Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Defining Abbrevs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Controlling Abbrev Expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Examining and Editing Abbrevs . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Saving Abbrevs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Dynamic Abbrev Expansion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Customizing Dynamic Abbreviation . . . . . . . . . . . . . . . . . . . . . . . . .

309
309
310
311
312
313
314


Dired, the Directory Editor . . . . . . . . . . . . . . . . 315

27.1
27.2
27.3
27.4
27.5
27.6
27.7
27.8
27.9
27.10
27.11
27.12

Entering Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Navigation in the Dired Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Deleting Files with Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Flagging Many Files at Once . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Visiting Files in Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Dired Marks vs. Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Operating on Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Shell Commands in Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Transforming File Names in Dired . . . . . . . . . . . . . . . . . . . . . . . . . .
File Comparison with Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Subdirectories in Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Moving Over Subdirectories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

315
316

316
317
318
318
320
322
323
324
325
325


xiii
27.13
27.14
27.15
27.16
27.17
27.18

28

Hiding Subdirectories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Updating the Dired Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Dired and find . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Editing the Dired Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Viewing Image Thumbnails in Dired . . . . . . . . . . . . . . . . . . . . . . .
Other Dired Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

The Calendar and the Diary . . . . . . . . . . . . . . . 331


28.1 Movement in the Calendar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.1.1 Motion by Standard Lengths of Time. . . . . . . . . . . . . . . . . . .
28.1.2 Beginning or End of Week, Month or Year. . . . . . . . . . . . . .
28.1.3 Specified Dates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.2 Scrolling in the Calendar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.3 Counting Days . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.4 Miscellaneous Calendar Commands . . . . . . . . . . . . . . . . . . . . . . . . .
28.5 Writing Calendar Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.6 Holidays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.7 Times of Sunrise and Sunset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.8 Phases of the Moon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.9 Conversion To and From Other Calendars . . . . . . . . . . . . . . . . . . .
28.9.1 Supported Calendar Systems . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.9.2 Converting To Other Calendars . . . . . . . . . . . . . . . . . . . . . . . .
28.9.3 Converting From Other Calendars . . . . . . . . . . . . . . . . . . . . . .
28.10 The Diary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.10.1 Displaying the Diary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.10.2 The Diary File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.10.3 Date Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.10.4 Commands to Add to the Diary . . . . . . . . . . . . . . . . . . . . . . .
28.10.5 Special Diary Entries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.11 Appointments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.12 Importing and Exporting Diary Entries . . . . . . . . . . . . . . . . . . . .
28.13 Daylight Saving Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.14 Summing Time Intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

29

326

326
327
328
328
329

331
331
332
332
333
333
333
334
335
336
337
338
338
339
340
341
341
342
343
344
344
346
347
347

348

Sending Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350

29.1 The Format of the Mail Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29.2 Mail Header Fields. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29.3 Mail Aliases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29.4 Mail Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29.4.1 Mail Sending. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29.4.2 Mail Header Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29.4.3 Citing Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29.4.4 Mail Miscellany . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29.5 Mail Signature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29.6 Mail Amusements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29.7 Mail-Composition Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

350
351
352
353
353
354
355
356
356
357
357


xiv


30

Reading Mail with Rmail . . . . . . . . . . . . . . . . . . 359

30.1 Basic Concepts of Rmail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.2 Scrolling Within a Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.3 Moving Among Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.4 Deleting Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.5 Rmail Files and Inboxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.6 Multiple Rmail Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.7 Copying Messages Out to Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.8 Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.9 Rmail Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.10 Sending Replies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.11 Summaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.11.1 Making Summaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.11.2 Editing in Summaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.12 Sorting the Rmail File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.13 Display of Messages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.14 Rmail and Coding Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.15 Editing Within a Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.16 Digest Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.17 Reading Rot13 Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.18 movemail program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30.19 Retrieving Mail from Remote Mailboxes. . . . . . . . . . . . . . . . . . . .
30.20 Retrieving Mail from Local Mailboxes in Various Formats . .

31


359
359
360
361
362
363
364
365
366
367
369
369
370
372
373
374
374
375
375
375
377
378

Miscellaneous Commands . . . . . . . . . . . . . . . . . . 379

31.1 Gnus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.1.1 Gnus Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.1.2 When Gnus Starts Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.1.3 Using the Gnus Group Buffer . . . . . . . . . . . . . . . . . . . . . . . . . .
31.1.4 Using the Gnus Summary Buffer . . . . . . . . . . . . . . . . . . . . . . .

31.2 Document Viewing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.2.1 DocView Navigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.2.2 DocView Searching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.2.3 DocView Slicing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.2.4 DocView Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.3 Web Browsing with EWW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.4 Running Shell Commands from Emacs . . . . . . . . . . . . . . . . . . . . . .
31.4.1 Single Shell Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.4.2 Interactive Subshell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.4.3 Shell Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.4.4 Shell Prompts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.4.5 Shell Command History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.4.5.1 Shell History Ring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.4.5.2 Shell History Copying . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.4.5.3 Shell History References . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.4.6 Directory Tracking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.4.7 Shell Mode Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.4.8 Emacs Terminal Emulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

379
379
379
380
380
381
381
382
382
382
383

383
383
384
385
387
388
388
389
390
390
390
391


xv
31.4.9 Term Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.4.10 Remote Host Shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.4.11 Serial Terminal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.5 Using Emacs as a Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.5.1 Invoking emacsclient . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.5.2 emacsclient Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.6 Printing Hard Copies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.6.1 PostScript Hardcopy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.6.2 Variables for PostScript Hardcopy . . . . . . . . . . . . . . . . . . . . . .
31.6.3 Printing Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.7 Sorting Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.8 Editing Binary Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.9 Saving Emacs Sessions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.10 Recursive Editing Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.11 Hyperlinking and Navigation Features. . . . . . . . . . . . . . . . . . . . . .

31.11.1 Following URLs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.11.2 Activating URLs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31.11.3 Finding Files and URLs at Point . . . . . . . . . . . . . . . . . . . . . .
31.12 Other Amusements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

32

Emacs Lisp Packages . . . . . . . . . . . . . . . . . . . . . . . 408

32.1
32.2
32.3

33

392
393
393
393
394
395
397
398
399
400
400
402
403
404
405

405
405
405
406

The Package Menu Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
Package Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
Package Files and Directory Layout . . . . . . . . . . . . . . . . . . . . . . . . . 411

Customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412

33.1 Easy Customization Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33.1.1 Customization Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33.1.2 Browsing and Searching for Settings . . . . . . . . . . . . . . . . . . . .
33.1.3 Changing a Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33.1.4 Saving Customizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33.1.5 Customizing Faces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33.1.6 Customizing Specific Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33.1.7 Custom Themes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33.1.8 Creating Custom Themes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33.2 Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33.2.1 Examining and Setting Variables . . . . . . . . . . . . . . . . . . . . . . .
33.2.2 Hooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33.2.3 Local Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33.2.4 Local Variables in Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33.2.4.1 Specifying File Variables . . . . . . . . . . . . . . . . . . . . . . . . . .
33.2.4.2 Safety of File Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33.2.5 Per-Directory Local Variables . . . . . . . . . . . . . . . . . . . . . . . . . .
33.3 Customizing Key Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33.3.1 Keymaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

33.3.2 Prefix Keymaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33.3.3 Local Keymaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33.3.4 Minibuffer Keymaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

412
412
413
413
416
416
417
418
419
420
421
422
423
424
424
426
427
428
429
429
430
430


xvi
33.3.5

33.3.6
33.3.7
33.3.8
33.3.9
33.3.10
33.3.11
33.4 The
33.4.1
33.4.2
33.4.3
33.4.4
33.4.5

34

Changing Key Bindings Interactively . . . . . . . . . . . . . . . . . . .
Rebinding Keys in Your Init File . . . . . . . . . . . . . . . . . . . . . . .
Modifier Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Rebinding Function Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Named ASCII Control Characters . . . . . . . . . . . . . . . . . . . . . .
Rebinding Mouse Buttons . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Disabling Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Emacs Initialization File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Init File Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Init File Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terminal-specific Initialization. . . . . . . . . . . . . . . . . . . . . . . . . .
How Emacs Finds Your Init File . . . . . . . . . . . . . . . . . . . . . . .
Non-ASCII Characters in Init Files . . . . . . . . . . . . . . . . . . . . .

431

432
433
433
434
435
437
437
438
439
441
442
442

Dealing with Common Problems . . . . . . . . . . 443

34.1 Quitting and Aborting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34.2 Dealing with Emacs Trouble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34.2.1 If DEL Fails to Delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34.2.2 Recursive Editing Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34.2.3 Garbage on the Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34.2.4 Garbage in the Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34.2.5 Running out of Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34.2.6 When Emacs Crashes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34.2.7 Recovery After a Crash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34.2.8 Emergency Escape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34.3 Reporting Bugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34.3.1 Reading Existing Bug Reports and Known Problems . . .
34.3.2 When Is There a Bug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34.3.3 Understanding Bug Reporting . . . . . . . . . . . . . . . . . . . . . . . . . .
34.3.4 Checklist for Bug Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

34.3.5 Sending Patches for GNU Emacs . . . . . . . . . . . . . . . . . . . . . . .
34.4 Contributing to Emacs Development . . . . . . . . . . . . . . . . . . . . . . . .
34.5 How To Get Help with GNU Emacs . . . . . . . . . . . . . . . . . . . . . . . . .

443
444
444
445
445
446
446
446
447
448
448
448
449
450
451
456
457
457

Appendix A GNU GENERAL PUBLIC
LICENSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
Appendix B GNU Free Documentation License
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470


xvii


Appendix C Command Line Arguments for
Emacs Invocation . . . . . . . . . . . . . . . . . . . . . . . . . . . 478
C.1 Action Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C.2 Initial Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C.3 Command Argument Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C.4 Environment Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C.4.1 General Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C.4.2 Miscellaneous Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C.4.3 The MS-Windows System Registry. . . . . . . . . . . . . . . . . . . . . .
C.5 Specifying the Display Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C.6 Font Specification Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C.7 Window Color Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C.8 Options for Window Size and Position . . . . . . . . . . . . . . . . . . . . . . .
C.9 Internal and External Borders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C.10 Frame Titles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C.11 Icons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C.12 Other Display Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Appendix D

X Options and Resources . . . . . . . 493

D.1 X Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D.2 Table of X Resources for Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D.3 GTK resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D.3.1 GTK Resource Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D.3.2 GTK widget names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D.3.3 GTK Widget Names in Emacs . . . . . . . . . . . . . . . . . . . . . . . . . .
D.3.4 GTK styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


Appendix E

478
480
482
482
483
485
486
487
487
488
489
490
491
491
492

493
494
495
496
496
497
498

Emacs 23 Antinews . . . . . . . . . . . . . 500

Appendix F Emacs and Mac OS / GNUstep

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 502
F.1 Basic Emacs usage under Mac OS and GNUstep . . . . . . . . . . . . .
F.1.1 Grabbing environment variables . . . . . . . . . . . . . . . . . . . . . . . . .
F.2 Mac / GNUstep Customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
F.2.1 Font and Color Panels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
F.3 Windowing System Events under Mac OS / GNUstep . . . . . . . .
F.4 GNUstep Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

502
502
503
503
503
504


xviii

Appendix G Emacs and Microsoft
Windows/MS-DOS . . . . . . . . . . . . . . . . . . . . . . . . . 505
G.1
G.2
G.3
G.4
G.5
G.6
G.7
G.8

How to Start Emacs on MS-Windows . . . . . . . . . . . . . . . . . . . . . . . .

Text Files and Binary Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
File Names on MS-Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Emulation of ls on MS-Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . .
HOME and Startup Directories on MS-Windows . . . . . . . . . . . . .
Keyboard Usage on MS-Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Mouse Usage on MS-Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Subprocesses on Windows 9X/ME and Windows NT/2K/XP
..............................................................
G.9 Printing and MS-Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
G.10 Specifying Fonts on MS-Windows. . . . . . . . . . . . . . . . . . . . . . . . . . .
G.11 Miscellaneous Windows-specific features . . . . . . . . . . . . . . . . . . . .

505
506
507
508
508
509
509
510
511
512
514

The GNU Manifesto . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515
What’s GNU? Gnu’s Not Unix! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Why I Must Write GNU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Why GNU Will Be Compatible with Unix . . . . . . . . . . . . . . . . . . . . . . . . .
How GNU Will Be Available . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Why Many Other Programmers Want to Help . . . . . . . . . . . . . . . . . . . . .

How You Can Contribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Why All Computer Users Will Benefit . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Some Easily Rebutted Objections to GNU’s Goals . . . . . . . . . . . . . . . . .

515
516
516
516
516
517
517
518

Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523
Key (Character) Index . . . . . . . . . . . . . . . . . . . . . . . . . . 546
Command and Function Index . . . . . . . . . . . . . . . . . . 555
Variable Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568
Concept Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575


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 integrated, 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. The tutorial is available
in several languages.
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 Common Problems chapter if Emacs does not seem to be working properly. It
explains how to cope with several common problems (see Section 34.2 [Dealing with Emacs
Trouble], page 444), as well as when and how to report Emacs bugs (see Section 34.3 [Bugs],
page 448).
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 reading from Emacs itself, or with the Info program. Info is the principal format for
documentation in the GNU system. 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 .
mit.edu/ai-publications/pdf/AIM-519A.pdf.
This version of the manual is mainly intended for use with GNU Emacs installed on GNU
and Unix systems. GNU Emacs can also be used on MS-DOS, Microsoft Windows, and

Macintosh systems. The Info file version of this manual contains some more information
about using Emacs on those systems. Those systems use different file name syntax; in
addition MS-DOS does not support all GNU Emacs features. See Appendix G [Microsoft
Windows], page 505, for information about using Emacs on Windows. See Appendix F
[Mac OS / GNUstep], page 502, for information about using Emacs on Macintosh (and
GNUstep).


Distribution

2

Distribution
GNU Emacs is free software; this means that everyone is free to use it and free to redistribute
it under 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 manual1 . See Appendix A [Copying], page 459.
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.

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. To donate, see For other ways in which you can
help, see />We also sell hardcopy versions of this manual and An Introduction to Programming in
Emacs Lisp, by Robert J. Chassell. You can visit our online store at .
org/. The income from sales goes to support the foundation’s purpose: the development
of new free software, and improvements to our existing programs including GNU Emacs.
If you need to contact the Free Software Foundation, see />contact/, or write to
Free Software Foundation
51 Franklin Street, Fifth Floor
Boston, MA 02110-1301
USA

Acknowledgments
Contributors to GNU Emacs include Jari Aalto, Per Abrahamsen, Tomas Abrahamsson,
Jay K. Adams, Alon Albert, Michael Albinus, Nagy Andras, Benjamin Andresen, Ralf Angeli, Dmitry Antipov, Joe Arceneaux, Emil ˚
Astr¨om, Miles Bader, David Bakhash, Juanma
Barranquero, Eli Barzilay, Thomas Baumann, Steven L. Baur, Jay Belanger, Alexander L.
Belikoff, Thomas Bellman, Scott Bender, Boaz Ben-Zvi, Sergey Berezin, Stephen Berman,
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 470.


Distribution

3


Karl Berry, Anna M. Bigatti, Ray Blaak, Martin Blais, Jim Blandy, Johan Bockg˚
ard,
Jan B¨ocker, Joel Boehland, Lennart Borgman, Per Bothner, Terrence Brannon, Frank
Bresz, Peter Breton, Emmanuel Briot, Kevin Broadey, Vincent Broman, Michael Brouwer,
David M. Brown, Stefan Bruda, Georges Brun-Cottan, Joe Buehler, Scott Byer, Wlodek
Bzyl, Bill Carpenter, Per Cederqvist, Hans Chalupsky, Chris Chase, Bob Chassell, Andrew Choi, Chong Yidong, Sacha Chua, Stewart Clamen, James Clark, Mike Clarkson,
Glynn Clements, Andrew Cohen, Daniel Colascione, Christoph Conrad, Ludovic Court`es,
Andrew Csillag, Toby Cubitt, Baoqiu Cui, Doug Cutting, Mathias Dahl, Julien Danjou,
Satyaki Das, Vivek Dasmohapatra, Dan Davison, Michael DeCorte, Gary Delp, Nachum
Dershowitz, Dave Detlefs, Matthieu Devin, Christophe de Dinechin, Eri Ding, Jan Dj¨arv,
Lawrence R. Dodd, Carsten Dominik, Scott Draves, Benjamin Drieu, Viktor Dukhovni,
Jacques Duthen, Dmitry Dzhus, John Eaton, Rolf Ebert, Carl Edman, David Edmondson,
Paul Eggert, Stephen Eglen, Christian Egli, Torbj¨orn Einarsson, Tsugutomo Enami, David
Engster, Hans Henrik Eriksen, Michael Ernst, Ata Etemadi, Frederick Farnbach, Oscar
Figueiredo, Fred Fish, Steve Fisk, Karl Fogel, Gary Foster, Eric S. Fraga, Romain Francoise,
Noah Friedman, Andreas Fuchs, Shigeru Fukaya, Xue Fuqiao, Hallvard Furuseth, Keith
Gabryelski, Peter S. Galbraith, Kevin Gallagher, Fabi´an E. Gallina, Kevin Gallo, Juan
Le´on Lahoz Garc´ıa, Howard Gayle, Daniel German, Stephen Gildea, Julien Gilles, David
Gillespie, Bob Glickstein, Deepak Goel, David De La Harpe Golden, Boris Goldowsky,
David Goodger, Chris Gray, Kevin Greiner, Michelangelo Grigni, Odd Gripenstam, Kai
Großjohann, Michael Gschwind, Bastien Guerry, Henry Guillaume, Dmitry Gutov, Doug
Gwyn, Bruno Haible, Ken’ichi Handa, Lars Hansen, Chris Hanson, Jesper Harder, Alexandru Harsanyi, K. Shane Hartman, John Heidemann, Jon K. Hellan, Magnus Henoch, Markus
Heritsch, Dirk Herrmann, Karl Heuer, Manabu Higashida, Konrad Hinsen, Anders Holst,
Jeffrey C. Honig, Tassilo Horn, Kurt Hornik, Tom Houlder, Joakim Hove, Denis Howe, Lars
Ingebrigtsen, Andrew Innes, Seiichiro Inoue, Philip Jackson, Martyn Jago, Pavel Janik,
Paul Jarc, Ulf Jasper, Thorsten Jolitz, Michael K. Johnson, Kyle Jones, Terry Jones, Simon Josefsson, Alexandre Julliard, Arne Jørgensen, Tomoji Kagatani, Brewster Kahle,
Tokuya Kameshima, Lute Kamstra, Ivan Kanis, David Kastrup, David Kaufman, Henry
Kautz, Taichi Kawabata, Taro Kawagishi, Howard Kaye, Michael Kifer, Richard King, Peter Kleiweg, Karel Kl´ıˇc, Shuhei Kobayashi, Pavel Kobyakov, Larry K. Kolodney, David M.
Koppelman, Koseki Yoshinori, Robert Krawitz, Sebastian Kremer, Ryszard Kubiak, Igor

Kuzmin, David K˚
agedal, Daniel LaLiberte, Karl Landstrom, Mario Lang, Aaron Larson,
James R. Larus, Vinicius Jose Latorre, Werner Lemberg, Frederic Lepied, Peter Liljenberg,
Christian Limpach, Lars Lindberg, Chris Lindblad, Anders Lindgren, Thomas Link, Juri
Linkov, Francis Litterio, Sergey Litvinov, Leo Liu, Emilio C. Lopes, Martin Lorentzon,
Dave Love, Eric Ludlam, K´
aroly L˝orentey, Sascha L¨
udecke, Greg McGary, Roland McGrath, Michael McNamara, Alan Mackenzie, Christopher J. Madsen, Neil M. Mager, Ken
Manheimer, Bill Mann, Brian Marick, Simon Marshall, Bengt Martensson, Charlie Martin,
Yukihiro Matsumoto, Tomohiro Matsuyama, David Maus, Thomas May, Will Mengarini,
David Megginson, Stefan Merten, Ben A. Mesander, Wayne Mesard, Brad Miller, Lawrence
Mitchell, Richard Mlynarik, Gerd M¨ollmann, Dani Moncayo, Stefan Monnier, Keith Moore,
Jan Moringen, Morioka Tomohiko, Glenn Morris, Don Morrison, Diane Murray, Riccardo
Murri, Sen Nagata, Erik Naggum, Gergely Nagy, Nobuyoshi Nakada, Thomas Neumann,
Mike Newton, Thien-Thi Nguyen, Jurgen Nickelsen, Dan Nicolaescu, Hrvoje Nikˇsi´c, Jeff
Norden, Andrew Norman, Edward O’Connor, Kentaro Ohkouchi, Christian Ohler, Kenichi
Okada, Alexandre Oliva, Bob Olson, Michael Olson, Takaaki Ota, Pieter E. J. Pareit, Ross


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

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