gnu emacs manual (pdf)

635
GNU Emacs Manual

Upload: nguyenkhanh

Post on 07-Feb-2017

235 views

Category:

Documents


2 download

TRANSCRIPT

  • GNU Emacs Manual

  • GNU Emacs Manual

    Seventeenth Edition, Updated for Emacs Version 25.2.

    Richard Stallman et al.

  • This is the Seventeenth edition of the GNU Emacs Manual,updated for Emacs version 25.2.

    Copyright c 19851987, 19932017 Free Software Foundation, Inc.Permission is granted to copy, distribute and/or modify this document underthe terms of the GNU Free Documentation License, Version 1.3 or any laterversion published by the Free Software Foundation; with the Invariant Sectionsbeing The GNU Manifesto, Distribution and GNU GENERAL PUBLICLICENSE, with the Front-Cover Texts being A GNU Manual, and with theBack-Cover Texts as in (a) below. A copy of the license is included in thesection entitled GNU Free Documentation License.

    (a) The FSFs Back-Cover Text is: You have the freedom to copy and modifythis GNU manual. Buying copies from the FSF supports it in developing GNUand promoting software freedom.

    Published by the Free Software Foundation51 Franklin Street, Fifth FloorBoston, MA 02110-1301 USAISBN 978-0-9831592-5-4

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

  • i

    Short Contents

    Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 The Organization of the Screen . . . . . . . . . . . . . . . . . . . . . . . . . . 62 Characters, Keys and Commands . . . . . . . . . . . . . . . . . . . . . . . . 113 Entering and Exiting Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 Basic Editing Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

    5 The Minibuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 Running Commands by Name . . . . . . . . . . . . . . . . . . . . . . . . . . 36

    7 Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388 The Mark and the Region . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

    9 Killing and Moving Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5410 Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6611 Controlling the Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

    12 Searching and Replacement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9213 Commands for Fixing Typos . . . . . . . . . . . . . . . . . . . . . . . . . . . 11514 Keyboard Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12115 File Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

    16 Using Multiple Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154

    17 Multiple Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16318 Frames and Graphical Displays . . . . . . . . . . . . . . . . . . . . . . . . 170

    19 International Character Set Support . . . . . . . . . . . . . . . . . . . . 18620 Major and Minor Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208

    21 Indentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21422 Commands for Human Languages . . . . . . . . . . . . . . . . . . . . . . 21723 Editing Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24924 Compiling and Testing Programs . . . . . . . . . . . . . . . . . . . . . . . 27125 Maintaining Large Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . 29126 Abbrevs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32227 Dired, the Directory Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328

    28 The Calendar and the Diary . . . . . . . . . . . . . . . . . . . . . . . . . . . 34529 Sending Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36430 Reading Mail with Rmail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373

  • ii

    31 Miscellaneous Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393

    32 Emacs Lisp Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42533 Customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42934 Dealing with Common Problems . . . . . . . . . . . . . . . . . . . . . . . 461A GNU GENERAL PUBLIC LICENSE . . . . . . . . . . . . . . . . . . . 478B GNU Free Documentation License . . . . . . . . . . . . . . . . . . . . . . 489

    C Command Line Arguments for Emacs Invocation . . . . . . . . . . 497D X Options and Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512E Emacs 24 Antinews . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519F Emacs and Mac OS / GNUstep . . . . . . . . . . . . . . . . . . . . . . . . 522G Emacs and Microsoft Windows/MS-DOS . . . . . . . . . . . . . . . . 525The GNU Manifesto . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543

    Key (Character) Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566Command and Function Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576Variable Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 590

    Concept Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 598

  • iii

    Table of Contents

    Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

    1 The Organization of the Screen . . . . . . . . . . . . . . . . 61.1 Point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61.2 The Echo Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71.3 The Mode Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81.4 The Menu Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

    2 Characters, Keys and Commands . . . . . . . . . . . . . 112.1 Kinds of User Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.2 Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.3 Keys and Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

    3 Entering and Exiting Emacs . . . . . . . . . . . . . . . . . . 143.1 Entering Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143.2 Exiting Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

    4 Basic Editing Commands . . . . . . . . . . . . . . . . . . . . . . 164.1 Inserting Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164.2 Changing the Location of Point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174.3 Erasing Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204.4 Undoing Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204.5 Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.6 Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.7 Blank Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.8 Continuation Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224.9 Cursor Position Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224.10 Numeric Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244.11 Repeating a Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

    5 The Minibuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265.1 Using the Minibuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265.2 Minibuffers for File Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265.3 Editing in the Minibuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275.4 Completion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

  • iv

    5.4.1 Completion Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285.4.2 Completion Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295.4.3 Completion Exit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305.4.4 How Completion Alternatives Are Chosen . . . . . . . . . . . . . . . . . 315.4.5 Completion Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

    5.5 Minibuffer History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325.6 Repeating Minibuffer Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345.7 Entering passwords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345.8 Yes or No Prompts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

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

    7 Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387.1 Documentation for a Key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407.2 Help by Command or Variable Name . . . . . . . . . . . . . . . . . . . . . . . . . . 407.3 Apropos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417.4 Help Mode Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437.5 Keyword Search for Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437.6 Help for International Language Support . . . . . . . . . . . . . . . . . . . . . . . 447.7 Other Help Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447.8 Help Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457.9 Help on Active Text and Tooltips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

    8 The Mark and the Region . . . . . . . . . . . . . . . . . . . . . 478.1 Setting the Mark . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478.2 Commands to Mark Textual Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . 498.3 Operating on the Region . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498.4 The Mark Ring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508.5 The Global Mark Ring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518.6 Shift Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518.7 Disabling Transient Mark Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

    9 Killing and Moving Text . . . . . . . . . . . . . . . . . . . . . . 549.1 Deletion and Killing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

    9.1.1 Deletion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549.1.2 Killing by Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559.1.3 Other Kill Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569.1.4 Options for Killing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

    9.2 Yanking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579.2.1 The Kill Ring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579.2.2 Yanking Earlier Kills . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579.2.3 Appending Kills . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

    9.3 Cut and Paste Operations on Graphical Displays . . . . . . . . . . . . 599.3.1 Using the Clipboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599.3.2 Cut and Paste with Other Window Applications . . . . . . . . . . 609.3.3 Secondary Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

  • v

    9.4 Accumulating Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 619.5 Rectangles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629.6 CUA Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

    10 Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6610.1 Saving Positions in Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6610.2 Saving Text in Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6610.3 Saving Rectangles in Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6710.4 Saving Window Configurations in Registers . . . . . . . . . . . . . . . . . . . 6810.5 Keeping Numbers in Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6810.6 Keeping File Names in Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6810.7 Keyboard Macro Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6910.8 Bookmarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

    11 Controlling the Display . . . . . . . . . . . . . . . . . . . . . . . 7111.1 Scrolling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7111.2 Recentering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7211.3 Automatic Scrolling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7311.4 Horizontal Scrolling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7411.5 Narrowing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7511.6 View Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7611.7 Follow Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7611.8 Text Faces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7611.9 Colors for Faces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7711.10 Standard Faces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7711.11 Text Scale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8011.12 Font Lock mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8111.13 Interactive Highlighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8211.14 Window Fringes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8411.15 Displaying Boundaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8411.16 Useless Whitespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8511.17 Selective Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8611.18 Optional Mode Line Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8711.19 How Text Is Displayed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8811.20 Displaying the Cursor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8911.21 Line Truncation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9011.22 Visual Line Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9011.23 Customization of Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

    12 Searching and Replacement . . . . . . . . . . . . . . . . . . 9212.1 Incremental Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92

    12.1.1 Basics of Incremental Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9212.1.2 Repeating Incremental Search . . . . . . . . . . . . . . . . . . . . . . . . . . . 9312.1.3 Isearch Yanking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9412.1.4 Errors in Incremental Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9412.1.5 Special Input for Incremental Search . . . . . . . . . . . . . . . . . . . . . 9512.1.6 Not Exiting Incremental Search . . . . . . . . . . . . . . . . . . . . . . . . . . 96

  • vi

    12.1.7 Searching the Minibuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9712.2 Nonincremental Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9712.3 Word Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9812.4 Symbol Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9912.5 Regular Expression Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9912.6 Syntax of Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10112.7 Backslash in Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10312.8 Regular Expression Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10512.9 Lax Matching During Searching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10612.10 Replacement Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107

    12.10.1 Unconditional Replacement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10712.10.2 Regexp Replacement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10812.10.3 Replace Commands and Lax Matches . . . . . . . . . . . . . . . . . . 10912.10.4 Query Replace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109

    12.11 Other Search-and-Loop Commands . . . . . . . . . . . . . . . . . . . . . . . . . 11212.12 Tailoring Search to Your Needs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113

    13 Commands for Fixing Typos . . . . . . . . . . . . . . . 11513.1 Undo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11513.2 Transposing Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11613.3 Case Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11713.4 Checking and Correcting Spelling . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117

    14 Keyboard Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12114.1 Basic Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12114.2 The Keyboard Macro Ring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12214.3 The Keyboard Macro Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12314.4 Executing Macros with Variations . . . . . . . . . . . . . . . . . . . . . . . . . . . 12514.5 Naming and Saving Keyboard Macros . . . . . . . . . . . . . . . . . . . . . . . 12514.6 Editing a Keyboard Macro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12614.7 Stepwise Editing a Keyboard Macro . . . . . . . . . . . . . . . . . . . . . . . . . 127

    15 File Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12915.1 File Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12915.2 Visiting Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13015.3 Saving Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133

    15.3.1 Commands for Saving Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13315.3.2 Backup Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134

    15.3.2.1 Single or Numbered Backups . . . . . . . . . . . . . . . . . . . . . . 13515.3.2.2 Automatic Deletion of Backups . . . . . . . . . . . . . . . . . . . . 13615.3.2.3 Copying vs. Renaming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136

    15.3.3 Customizing Saving of Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13715.3.4 Protection against Simultaneous Editing . . . . . . . . . . . . . . . . 13715.3.5 Shadowing Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13815.3.6 Updating Time Stamps Automatically . . . . . . . . . . . . . . . . . . 139

    15.4 Reverting a Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13915.5 Auto-Saving: Protection Against Disasters . . . . . . . . . . . . . . . . . . . 140

  • vii

    15.5.1 Auto-Save Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14115.5.2 Controlling Auto-Saving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14115.5.3 Recovering Data from Auto-Saves . . . . . . . . . . . . . . . . . . . . . . 142

    15.6 File Name Aliases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14315.7 File Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14315.8 Comparing Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14415.9 Diff Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14515.10 Miscellaneous File Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14715.11 Accessing Compressed Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14815.12 File Archives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14815.13 Remote Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14915.14 Quoted File Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15015.15 File Name Cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15115.16 Convenience Features for Finding Files . . . . . . . . . . . . . . . . . . . . . 15215.17 Filesets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152

    16 Using Multiple Buffers . . . . . . . . . . . . . . . . . . . . . . 15416.1 Creating and Selecting Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15416.2 Listing Existing Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15616.3 Miscellaneous Buffer Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15616.4 Killing Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15716.5 Operating on Several Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15816.6 Indirect Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16016.7 Convenience Features and Customization of Buffer Handling . . 160

    16.7.1 Making Buffer Names Unique . . . . . . . . . . . . . . . . . . . . . . . . . . . 16116.7.2 Fast minibuffer selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16116.7.3 Customizing Buffer Menus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162

    17 Multiple Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . 16317.1 Concepts of Emacs Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16317.2 Splitting Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16317.3 Using Other Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16417.4 Displaying in Another Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16517.5 Deleting and Resizing Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16617.6 Displaying a Buffer in a Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167

    17.6.1 How display-buffer works . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16717.6.2 Displaying non-editable buffers. . . . . . . . . . . . . . . . . . . . . . . . . . 168

    17.7 Convenience Features for Window Handling . . . . . . . . . . . . . . . . . 169

    18 Frames and Graphical Displays . . . . . . . . . . . . . 17018.1 Mouse Commands for Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17018.2 Mouse Commands for Words and Lines . . . . . . . . . . . . . . . . . . . . . . 17218.3 Following References with the Mouse . . . . . . . . . . . . . . . . . . . . . . . . 17218.4 Mouse Clicks for Menus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17318.5 Mode Line Mouse Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17318.6 Creating Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17418.7 Frame Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175

  • viii

    18.8 Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17618.9 Speedbar Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17918.10 Multiple Displays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17918.11 Frame Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18018.12 Scroll Bars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18018.13 Window Dividers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18118.14 Drag and Drop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18218.15 Menu Bars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18218.16 Tool Bars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18218.17 Using Dialog Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18318.18 Tooltips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18318.19 Mouse Avoidance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18418.20 Non-Window Terminals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18518.21 Using a Mouse in Text Terminals . . . . . . . . . . . . . . . . . . . . . . . . . . . 185

    19 International Character Set Support . . . . . . . 18619.1 Introduction to International Character Sets . . . . . . . . . . . . . . . . . 18619.2 Language Environments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18819.3 Input Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19019.4 Selecting an Input Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19119.5 Coding Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19319.6 Recognizing Coding Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19419.7 Specifying a Files Coding System . . . . . . . . . . . . . . . . . . . . . . . . . . . 19619.8 Choosing Coding Systems for Output . . . . . . . . . . . . . . . . . . . . . . . . 19619.9 Specifying a Coding System for File Text . . . . . . . . . . . . . . . . . . . . 19719.10 Coding Systems for Interprocess Communication . . . . . . . . . . . 19819.11 Coding Systems for File Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19919.12 Coding Systems for Terminal I/O . . . . . . . . . . . . . . . . . . . . . . . . . . 20019.13 Fontsets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20119.14 Defining fontsets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20219.15 Modifying Fontsets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20319.16 Undisplayable Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20419.17 Unibyte Editing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20419.18 Charsets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20519.19 Bidirectional Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206

    20 Major and Minor Modes . . . . . . . . . . . . . . . . . . . . 20820.1 Major Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20820.2 Minor Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20920.3 Choosing File Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211

    21 Indentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21421.1 Indentation Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21421.2 Tab Stops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21521.3 Tabs vs. Spaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21621.4 Convenience Features for Indentation . . . . . . . . . . . . . . . . . . . . . . . . 216

  • ix

    22 Commands for Human Languages . . . . . . . . . 21722.1 Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21722.2 Sentences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21822.3 Paragraphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21922.4 Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22022.5 Quotation Marks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22122.6 Filling Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221

    22.6.1 Auto Fill Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22122.6.2 Explicit Fill Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22222.6.3 The Fill Prefix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22322.6.4 Adaptive Filling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224

    22.7 Case Conversion Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22522.8 Text Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22622.9 Outline Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227

    22.9.1 Format of Outlines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22722.9.2 Outline Motion Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22822.9.3 Outline Visibility Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . 22922.9.4 Viewing One Outline in Multiple Views . . . . . . . . . . . . . . . . . 23022.9.5 Folding Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230

    22.10 Org Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23222.10.1 Org as an organizer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23222.10.2 Org as an authoring system . . . . . . . . . . . . . . . . . . . . . . . . . . . 233

    22.11 TEX Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23322.11.1 TEX Editing Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23422.11.2 LATEX Editing Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23522.11.3 TEX Printing Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23522.11.4 TEX Mode Miscellany . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237

    22.12 SGML and HTML Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23822.13 Nroff Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23922.14 Enriched Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239

    22.14.1 Enriched Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24022.14.2 Hard and Soft Newlines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24022.14.3 Editing Format Information . . . . . . . . . . . . . . . . . . . . . . . . . . . 24122.14.4 Faces in Enriched Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24122.14.5 Indentation in Enriched Text . . . . . . . . . . . . . . . . . . . . . . . . . . 24222.14.6 Justification in Enriched Text . . . . . . . . . . . . . . . . . . . . . . . . . 24222.14.7 Setting Other Text Properties . . . . . . . . . . . . . . . . . . . . . . . . . 243

    22.15 Editing Text-based Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24322.15.1 What is a Text-based Table? . . . . . . . . . . . . . . . . . . . . . . . . . . 24322.15.2 Creating a Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24422.15.3 Table Recognition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24422.15.4 Commands for Table Cells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24522.15.5 Cell Justification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24522.15.6 Table Rows and Columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24622.15.7 Converting Between Plain Text and Tables . . . . . . . . . . . . 24622.15.8 Table Miscellany . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247

    22.16 Two-Column Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248

  • x

    23 Editing Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24923.1 Major Modes for Programming Languages . . . . . . . . . . . . . . . . . . . 24923.2 Top-Level Definitions, or Defuns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250

    23.2.1 Left Margin Convention . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25023.2.2 Moving by Defuns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25023.2.3 Imenu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25123.2.4 Which Function Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252

    23.3 Indentation for Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25223.3.1 Basic Program Indentation Commands . . . . . . . . . . . . . . . . . 25223.3.2 Indenting Several Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25323.3.3 Customizing Lisp Indentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 25323.3.4 Commands for C Indentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 25423.3.5 Customizing C Indentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254

    23.4 Commands for Editing with Parentheses . . . . . . . . . . . . . . . . . . . . . 25523.4.1 Expressions with Balanced Parentheses . . . . . . . . . . . . . . . . . 25523.4.2 Moving in the Parenthesis Structure . . . . . . . . . . . . . . . . . . . . 25723.4.3 Matching Parentheses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257

    23.5 Manipulating Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25823.5.1 Comment Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25923.5.2 Multiple Lines of Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26023.5.3 Options Controlling Comments . . . . . . . . . . . . . . . . . . . . . . . . . 261

    23.6 Documentation Lookup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26123.6.1 Info Documentation Lookup . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26223.6.2 Man Page Lookup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26223.6.3 Emacs Lisp Documentation Lookup . . . . . . . . . . . . . . . . . . . . . 263

    23.7 Hideshow minor mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26323.8 Completion for Symbol Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26423.9 MixedCase Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26423.10 Semantic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26523.11 Other Features Useful for Editing Programs . . . . . . . . . . . . . . . . 26523.12 C and Related Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266

    23.12.1 C Mode Motion Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . 26623.12.2 Electric C Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26723.12.3 Hungry Delete Feature in C . . . . . . . . . . . . . . . . . . . . . . . . . . . 26723.12.4 Other Commands for C Mode . . . . . . . . . . . . . . . . . . . . . . . . . 268

    23.13 Asm Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269

    24 Compiling and Testing Programs . . . . . . . . . . 27124.1 Running Compilations under Emacs . . . . . . . . . . . . . . . . . . . . . . . . . 27124.2 Compilation Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27224.3 Subshells for Compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27424.4 Searching with Grep under Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . 27424.5 Finding Syntax Errors On The Fly . . . . . . . . . . . . . . . . . . . . . . . . . . 27624.6 Running Debuggers Under Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . 276

    24.6.1 Starting GUD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27624.6.2 Debugger Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27724.6.3 Commands of GUD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278

  • xi

    24.6.4 GUD Customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28024.6.5 GDB Graphical Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280

    24.6.5.1 GDB User Interface Layout . . . . . . . . . . . . . . . . . . . . . . . . 28124.6.5.2 Source Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28124.6.5.3 Breakpoints Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28224.6.5.4 Threads Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28224.6.5.5 Stack Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28324.6.5.6 Other GDB Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28324.6.5.7 Watch Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28424.6.5.8 Multithreaded Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . 285

    24.7 Executing Lisp Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28624.8 Libraries of Lisp Code for Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28624.9 Evaluating Emacs Lisp Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . 28824.10 Lisp Interaction Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28924.11 Running an External Lisp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289

    25 Maintaining Large Programs . . . . . . . . . . . . . . . 29125.1 Version Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291

    25.1.1 Introduction to Version Control . . . . . . . . . . . . . . . . . . . . . . . . . 29125.1.1.1 Understanding the problems it addresses . . . . . . . . . . . 29225.1.1.2 Supported Version Control Systems . . . . . . . . . . . . . . . . 29225.1.1.3 Concepts of Version Control . . . . . . . . . . . . . . . . . . . . . . . 29325.1.1.4 Merge-based vs lock-based Version Control . . . . . . . . . 29325.1.1.5 Changeset-based vs File-based Version Control . . . . . 29425.1.1.6 Decentralized vs Centralized Repositories . . . . . . . . . . 29425.1.1.7 Types of Log File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294

    25.1.2 Version Control and the Mode Line . . . . . . . . . . . . . . . . . . . . . 29525.1.3 Basic Editing under Version Control . . . . . . . . . . . . . . . . . . . . 295

    25.1.3.1 Basic Version Control with Merging . . . . . . . . . . . . . . . . 29625.1.3.2 Basic Version Control with Locking . . . . . . . . . . . . . . . . 29725.1.3.3 Advanced Control in C-x v v . . . . . . . . . . . . . . . . . . . . . . 297

    25.1.4 Features of the Log Entry Buffer . . . . . . . . . . . . . . . . . . . . . . . . 29825.1.5 Registering a File for Version Control . . . . . . . . . . . . . . . . . . . 29825.1.6 Examining And Comparing Old Revisions . . . . . . . . . . . . . . 29925.1.7 VC Change Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30125.1.8 Undoing Version Control Actions . . . . . . . . . . . . . . . . . . . . . . . 30325.1.9 Ignore Version Control Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30325.1.10 VC Directory Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303

    25.1.10.1 The VC Directory Buffer . . . . . . . . . . . . . . . . . . . . . . . . . 30325.1.10.2 VC Directory Commands . . . . . . . . . . . . . . . . . . . . . . . . . 304

    25.1.11 Version Control Branches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30525.1.11.1 Switching between Branches . . . . . . . . . . . . . . . . . . . . . . 30625.1.11.2 Pulling/Pushing Changes into/from a Branch . . . . . 30625.1.11.3 Merging Branches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30725.1.11.4 Creating New Branches . . . . . . . . . . . . . . . . . . . . . . . . . . . 308

    25.2 Change Logs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30825.2.1 Change Log Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30825.2.2 Format of ChangeLog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309

  • xii

    25.3 Find Identifier References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31025.3.1 Find Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310

    25.3.1.1 Looking Up Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31125.3.1.2 Commands Available in the *xref* Buffer . . . . . . . . . 31225.3.1.3 Searching and Replacing with Identifiers . . . . . . . . . . . 31225.3.1.4 Identifier Inquiries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313

    25.3.2 Tags Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31425.3.2.1 Source File Tag Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31425.3.2.2 Creating Tags Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31625.3.2.3 Etags Regexps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318

    25.3.3 Selecting a Tags Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31925.4 Emacs Development Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . 320

    26 Abbrevs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32226.1 Abbrev Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32226.2 Defining Abbrevs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32226.3 Controlling Abbrev Expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32326.4 Examining and Editing Abbrevs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32426.5 Saving Abbrevs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32526.6 Dynamic Abbrev Expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32626.7 Customizing Dynamic Abbreviation . . . . . . . . . . . . . . . . . . . . . . . . . 327

    27 Dired, the Directory Editor . . . . . . . . . . . . . . . . . 32827.1 Entering Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32827.2 Navigation in the Dired Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32927.3 Deleting Files with Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32927.4 Flagging Many Files at Once . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33027.5 Visiting Files in Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33127.6 Dired Marks vs. Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33127.7 Operating on Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33327.8 Shell Commands in Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33627.9 Transforming File Names in Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . 33727.10 File Comparison with Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33827.11 Subdirectories in Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33827.12 Moving Over Subdirectories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33927.13 Hiding Subdirectories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33927.14 Updating the Dired Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34027.15 Dired and find . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34127.16 Editing the Dired Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34127.17 Viewing Image Thumbnails in Dired . . . . . . . . . . . . . . . . . . . . . . . . 34227.18 Other Dired Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343

  • xiii

    28 The Calendar and the Diary . . . . . . . . . . . . . . . . 34528.1 Movement in the Calendar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345

    28.1.1 Motion by Standard Lengths of Time . . . . . . . . . . . . . . . . . . . 34528.1.2 Beginning or End of Week, Month or Year . . . . . . . . . . . . . . 34628.1.3 Specified Dates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346

    28.2 Scrolling in the Calendar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34728.3 Counting Days . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34728.4 Miscellaneous Calendar Commands . . . . . . . . . . . . . . . . . . . . . . . . . . 34728.5 Writing Calendar Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34828.6 Holidays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34928.7 Times of Sunrise and Sunset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35028.8 Phases of the Moon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35128.9 Conversion To and From Other Calendars . . . . . . . . . . . . . . . . . . . 352

    28.9.1 Supported Calendar Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . 35228.9.2 Converting To Other Calendars . . . . . . . . . . . . . . . . . . . . . . . . . 35328.9.3 Converting From Other Calendars . . . . . . . . . . . . . . . . . . . . . . 354

    28.10 The Diary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35528.10.1 The Diary File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35528.10.2 Displaying the Diary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35628.10.3 Date Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35728.10.4 Commands to Add to the Diary . . . . . . . . . . . . . . . . . . . . . . . 35828.10.5 Special Diary Entries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358

    28.11 Appointments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36028.12 Importing and Exporting Diary Entries . . . . . . . . . . . . . . . . . . . . . 36128.13 Daylight Saving Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36128.14 Summing Time Intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362

    29 Sending Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36429.1 The Format of the Mail Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36429.2 Mail Header Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36529.3 Mail Aliases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36629.4 Mail Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367

    29.4.1 Mail Sending . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36729.4.2 Mail Header Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36829.4.3 Citing Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36929.4.4 Mail Miscellany . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370

    29.5 Mail Signature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37029.6 Mail Amusements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37129.7 Mail-Composition Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371

  • xiv

    30 Reading Mail with Rmail . . . . . . . . . . . . . . . . . . . 37330.1 Basic Concepts of Rmail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37330.2 Scrolling Within a Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37330.3 Moving Among Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37430.4 Deleting Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37530.5 Rmail Files and Inboxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37630.6 Multiple Rmail Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37730.7 Copying Messages Out to Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37830.8 Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37930.9 Rmail Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38030.10 Sending Replies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38130.11 Summaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383

    30.11.1 Making Summaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38330.11.2 Editing in Summaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384

    30.12 Sorting the Rmail File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38630.13 Display of Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38730.14 Rmail and Coding Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38830.15 Editing Within a Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38930.16 Digest Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38930.17 Reading Rot13 Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38930.18 movemail program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39030.19 Retrieving Mail from Remote Mailboxes . . . . . . . . . . . . . . . . . . . . 39130.20 Retrieving Mail from Local Mailboxes in Various Formats . . . 392

    31 Miscellaneous Commands . . . . . . . . . . . . . . . . . . . 39331.1 Gnus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393

    31.1.1 Gnus Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39331.1.2 When Gnus Starts Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39331.1.3 Using the Gnus Group Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . 39431.1.4 Using the Gnus Summary Buffer . . . . . . . . . . . . . . . . . . . . . . . . 394

    31.2 Host Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39531.3 Network Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39531.4 Document Viewing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397

    31.4.1 DocView Navigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39731.4.2 DocView Searching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39831.4.3 DocView Slicing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39831.4.4 DocView Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399

    31.5 Web Browsing with EWW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39931.6 Embedded WebKit Widgets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39931.7 Running Shell Commands from Emacs . . . . . . . . . . . . . . . . . . . . . . . 399

    31.7.1 Single Shell Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40031.7.2 Interactive Subshell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40131.7.3 Shell Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40231.7.4 Shell Prompts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40431.7.5 Shell Command History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404

    31.7.5.1 Shell History Ring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40431.7.5.2 Shell History Copying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405

  • xv

    31.7.5.3 Shell History References . . . . . . . . . . . . . . . . . . . . . . . . . . . 40631.7.6 Directory Tracking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40631.7.7 Shell Mode Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40731.7.8 Emacs Terminal Emulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40831.7.9 Term Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40831.7.10 Remote Host Shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40931.7.11 Serial Terminal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409

    31.8 Using Emacs as a Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40931.8.1 Invoking emacsclient . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41031.8.2 emacsclient Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411

    31.9 Printing Hard Copies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41431.9.1 PostScript Hardcopy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41431.9.2 Variables for PostScript Hardcopy . . . . . . . . . . . . . . . . . . . . . . 41531.9.3 Printing Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416

    31.10 Sorting Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41731.11 Editing Binary Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41931.12 Saving Emacs Sessions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41931.13 Recursive Editing Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42031.14 Hyperlinking and Navigation Features . . . . . . . . . . . . . . . . . . . . . . 421

    31.14.1 Following URLs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42131.14.2 Activating URLs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42231.14.3 Finding Files and URLs at Point . . . . . . . . . . . . . . . . . . . . . . 422

    31.15 Other Amusements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423

    32 Emacs Lisp Packages . . . . . . . . . . . . . . . . . . . . . . . . 42532.1 The Package Menu Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42532.2 Package Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42632.3 Package Files and Directory Layout . . . . . . . . . . . . . . . . . . . . . . . . . 428

    33 Customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42933.1 Easy Customization Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429

    33.1.1 Customization Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42933.1.2 Browsing and Searching for Settings . . . . . . . . . . . . . . . . . . . . 43033.1.3 Changing a Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43033.1.4 Saving Customizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43333.1.5 Customizing Faces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43333.1.6 Customizing Specific Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43433.1.7 Custom Themes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43533.1.8 Creating Custom Themes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437

    33.2 Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43733.2.1 Examining and Setting Variables . . . . . . . . . . . . . . . . . . . . . . . 43833.2.2 Hooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43933.2.3 Local Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44033.2.4 Local Variables in Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441

    33.2.4.1 Specifying File Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . 44233.2.4.2 Safety of File Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444

    33.2.5 Per-Directory Local Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . 445

  • xvi

    33.3 Customizing Key Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44633.3.1 Keymaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44633.3.2 Prefix Keymaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44733.3.3 Local Keymaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44733.3.4 Minibuffer Keymaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44833.3.5 Changing Key Bindings Interactively . . . . . . . . . . . . . . . . . . . 44833.3.6 Rebinding Keys in Your Init File . . . . . . . . . . . . . . . . . . . . . . . 44933.3.7 Modifier Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45033.3.8 Rebinding Function Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45133.3.9 Named ASCII Control Characters . . . . . . . . . . . . . . . . . . . . . . . 45233.3.10 Rebinding Mouse Buttons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45233.3.11 Disabling Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454

    33.4 The Emacs Initialization File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45533.4.1 Init File Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45533.4.2 Init File Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45633.4.3 Terminal-specific Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . 45833.4.4 How Emacs Finds Your Init File . . . . . . . . . . . . . . . . . . . . . . . . 45933.4.5 Non-ASCII Characters in Init Files . . . . . . . . . . . . . . . . . . . . . . 459

    34 Dealing with Common Problems . . . . . . . . . . . 46134.1 Quitting and Aborting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46134.2 Dealing with Emacs Trouble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462

    34.2.1 If DEL Fails to Delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46234.2.2 Recursive Editing Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46334.2.3 Garbage on the Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46334.2.4 Garbage in the Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46434.2.5 Running out of Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46434.2.6 When Emacs Crashes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46434.2.7 Recovery After a Crash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46534.2.8 Emergency Escape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466

    34.3 Reporting Bugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46634.3.1 Reading Existing Bug Reports and Known Problems . . . . 46634.3.2 When Is There a Bug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46734.3.3 Understanding Bug Reporting . . . . . . . . . . . . . . . . . . . . . . . . . . 46834.3.4 Checklist for Bug Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46934.3.5 Sending Patches for GNU Emacs . . . . . . . . . . . . . . . . . . . . . . . 474

    34.4 Contributing to Emacs Development . . . . . . . . . . . . . . . . . . . . . . . . . 47634.4.1 Coding Standards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47734.4.2 Copyright Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477

    34.5 How To Get Help with GNU Emacs . . . . . . . . . . . . . . . . . . . . . . . . . 477

    Appendix A GNU GENERALPUBLIC LICENSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478

    Appendix B GNU Free Documentation License . . 489

  • xvii

    Appendix C Command Line Argumentsfor Emacs Invocation . . . . . . . . . . . . . . . . . . . . . . . . . . 497C.1 Action Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497C.2 Initial Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499C.3 Command Argument Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501C.4 Environment Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501

    C.4.1 General Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 502C.4.2 Miscellaneous Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504C.4.3 The MS-Windows System Registry . . . . . . . . . . . . . . . . . . . . . . 505

    C.5 Specifying the Display Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506C.6 Font Specification Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506C.7 Window Color Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506C.8 Options for Window Size and Position . . . . . . . . . . . . . . . . . . . . . . . . 508C.9 Internal and External Borders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509C.10 Frame Titles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510C.11 Icons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510C.12 Other Display Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511

    Appendix D X Options and Resources . . . . . . . . 512D.1 X Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512D.2 Table of X Resources for Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513D.3 GTK resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514

    D.3.1 GTK Resource Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515D.3.2 GTK widget names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515D.3.3 GTK Widget Names in Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . 516D.3.4 GTK styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517

    Appendix E Emacs 24 Antinews . . . . . . . . . . . . . . . 519

    Appendix F Emacs and Mac OS / GNUstep . . 522F.1 Basic Emacs usage under Mac OS and GNUstep . . . . . . . . . . . . . . 522

    F.1.1 Grabbing environment variables . . . . . . . . . . . . . . . . . . . . . . . . . 522F.2 Mac / GNUstep Customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523

    F.2.1 Font and Color Panels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523F.3 Windowing System Events under Mac OS / GNUstep . . . . . . . . 523F.4 GNUstep Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524

    Appendix G Emacs and MicrosoftWindows/MS-DOS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525G.1 How to Start Emacs on MS-Windows . . . . . . . . . . . . . . . . . . . . . . . . 525G.2 Text Files and Binary Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 526G.3 File Names on MS-Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527G.4 Emulation of ls on MS-Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528G.5 HOME and Startup Directories on MS-Windows . . . . . . . . . . . . . 528G.6 Keyboard Usage on MS-Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529

  • xviii

    G.7 Mouse Usage on MS-Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529

    G.8 Subprocesses on Windows 9X/ME andWindows NT/2K/XP/Vista/7/8/10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530

    G.9 Printing and MS-Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531G.10 Specifying Fonts on MS-Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . 533G.11 Miscellaneous Windows-specific features . . . . . . . . . . . . . . . . . . . . . 534

    The GNU Manifesto . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535Whats GNU? Gnus Not Unix! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535Why I Must Write GNU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536Why GNU Will Be Compatible with Unix . . . . . . . . . . . . . . . . . . . . . . . . . 536How GNU Will Be Available . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536Why Many Other Programmers Want to Help . . . . . . . . . . . . . . . . . . . . . 536How You Can Contribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 537Why All Computer Users Will Benefit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 537Some Easily Rebutted Objections to GNUs Goals . . . . . . . . . . . . . . . . . 538

    Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543

    Key (Character) Index . . . . . . . . . . . . . . . . . . . . . . . . . . . 566

    Command and Function Index . . . . . . . . . . . . . . . . . . 576

    Variable Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 590

    Concept Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 598

  • 1

    Preface

    This manual documents the use and simple customization of the Emacs editor. SimpleEmacs customizations do not require you to be a programmer, but if you are not interestedin customizing, you can ignore the customization hints.

    This is primarily a reference manual, but can also be used as a primer. If you arenew to Emacs, we recommend you start with the integrated, learn-by-doing tutorial, beforereading the manual. To run the tutorial, start Emacs and type C-h t. The tutorial describescommands, tells you when to try them, and explains the results. The tutorial is availablein several languages.

    On first reading, just skim chapters 1 and 2, which describe the notational conventions ofthe manual and the general appearance of the Emacs display screen. Note which questionsare answered in these chapters, so you can refer back later. After reading chapter 4, youshould practice the commands shown there. The next few chapters describe fundamentaltechniques 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 manykinds 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. Itexplains how to cope with several common problems (see Section 34.2 [Dealing with EmacsTrouble], page 462), as well as when and how to report Emacs bugs (see Section 34.3 [Bugs],page 466).

    To find the documentation of a particular command, look in the index. Keys (charactercommands) and command names have separate indexes. There is also a glossary, with across reference for each term.

    This manual is available as a printed book and also as an Info file. The Info file isfor reading from Emacs itself, or with the Info program. Info is the principal format fordocumentation in the GNU system. The Info file and the printed book contain substantiallythe same text and are generated from the same source files, which are also distributed withGNU 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 philos-ophy of Emacs and the lessons learned from its development, see Emacs, the Extensible,Customizable Self-Documenting Display Editor, available from ftp://publications.ai.mit.edu/ai-publications/pdf/AIM-519A.pdf.

    This version of the manual is mainly intended for use with GNU Emacs installed on GNUand Unix systems. GNU Emacs can also be used on MS-DOS, Microsoft Windows, andMacintosh systems. The Info file version of this manual contains some more informationabout using Emacs on those systems. Those systems use different file name syntax; inaddition MS-DOS does not support all GNU Emacs features. See Appendix G [MicrosoftWindows], page 525, for information about using Emacs on Windows. See Appendix F[Mac OS / GNUstep], page 522, for information about using Emacs on Macintosh (andGNUstep).

    ftp://publications.ai.mit.edu/ai-publications/pdf/AIM-519A.pdfftp://publications.ai.mit.edu/ai-publications/pdf/AIM-519A.pdf

  • 2

    Distribution

    GNU Emacs is free software; this means that everyone is free to use it and free to redistributeit under certain conditions. GNU Emacs is not in the public domain; it is copyrightedand there are restrictions on its distribution, but these restrictions are designed to permiteverything that a good cooperating citizen would want to do. What is not allowed is to tryto prevent others from further sharing any version of GNU Emacs that they might get fromyou. The precise conditions are found in the GNU General Public License that comes withEmacs and also appears in this manual1. See Appendix A [Copying], page 478.

    One way to get a copy of GNU Emacs is from someone else who has it. You need notask for our permission to do so, or tell any one else; just copy it. If you have access to theInternet, you can get the latest distribution version of GNU Emacs by anonymous FTP;see http://www.gnu.org/software/emacs on our website for more information.

    You may also receive GNU Emacs when you buy a computer. Computer manufacturersare free to distribute copies on the same terms that apply to everyone else. These termsrequire 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 usualterms of the General Public License. In other words, the program must be free for youwhen you get it, not just free for the manufacturer.

    If you find GNU Emacs useful, please send a donation to the Free Software Foundationto support our work. Donations to the Free Software Foundation are tax deductible in theUS. If you use GNU Emacs at your workplace, please suggest that the company make adonation. To donate, see https://my.fsf.org/donate/. For other ways in which you canhelp, see http://www.gnu.org/help/help.html.

    We also sell hardcopy versions of this manual and An Introduction to Programming inEmacs Lisp, by Robert J. Chassell. You can visit our online store at http://shop.fsf.org/. The income from sales goes to support the foundations purpose: the developmentof new free software, and improvements to our existing programs including GNU Emacs.

    If you need to contact the Free Software Foundation, see http://www.fsf.org/about/contact/, or write to

    Free Software Foundation51 Franklin Street, Fifth FloorBoston, MA 02110-1301USA

    Acknowledgments

    Contributors to GNU Emacs include Jari Aalto, Per Abrahamsen, Tomas Abrahamsson,Jay K. Adams, Alon Albert, Michael Albinus, Nagy Andras, Benjamin Andresen, Ralf An-geli, Dmitry Antipov, Joe Arceneaux, Emil Astrom, Miles Bader, David Bakhash, JuanmaBarranquero, 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 spiritto the General Public License, but is more suitable for documentation. See Appendix B [GNU FreeDocumentation License], page 489.

    http://www.gnu.org/software/emacshttps://my.fsf.org/donate/http://www.gnu.org/help/help.htmlhttp://shop.fsf.org/http://shop.fsf.org/http://www.fsf.org/about/contact/http://www.fsf.org/about/contact/

  • Distribution 3

    Karl Berry, Anna M. Bigatti, Ray Blaak, Martin Blais, Jim Blandy, Johan Bockgard,Jan Bocker, Joel Boehland, Lennart Borgman, Per Bothner, Terrence Brannon, FrankBresz, Peter Breton, Emmanuel Briot, Kevin Broadey, Vincent Broman, Michael Brouwer,David M. Brown, Stefan Bruda, Georges Brun-Cottan, Joe Buehler, Scott Byer, W lodekBzyl, Bill Carpenter, Per Cederqvist, Hans Chalupsky, Chris Chase, Bob Chassell, An-drew Choi, Chong Yidong, Sacha Chua, Stewart Clamen, James Clark, Mike Clarkson,Glynn Clements, Andrew Cohen, Daniel Colascione, Christoph Conrad, Ludovic Courtes,Andrew Csillag, Toby Cubitt, Baoqiu Cui, Doug Cutting, Mathias Dahl, Julien Danjou,Satyaki Das, Vivek Dasmohapatra, Dan Davison, Michael DeCorte, Gary Delp, NachumDershowitz, Dave Detlefs, Matthieu Devin, Christophe de Dinechin, Eri Ding, Jan Djarv,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, Torbjorn Einarsson, Tsugutomo Enami, DavidEngster, Hans Henrik Eriksen, Michael Ernst, Ata Etemadi, Frederick Farnbach, OscarFigueiredo, Fred Fish, Steve Fisk, Karl Fogel, Gary Foster, Eric S. Fraga, Romain Francoise,Noah Friedman, Andreas Fuchs, Shigeru Fukaya, Xue Fuqiao, Hallvard Furuseth, KeithGabryelski, Peter S. Galbraith, Kevin Gallagher, Fabian E. Gallina, Kevin Gallo, JuanLeon Lahoz Garca, Howard Gayle, Daniel German, Stephen Gildea, Julien Gilles, DavidGillespie, Bob Glickstein, Deepak Goel, David De La Harpe Golden, Boris Goldowsky,David Goodger, Chris Gray, Kevin Greiner, Michelangelo Grigni, Odd Gripenstam, KaiGrojohann, Michael Gschwind, Bastien Guerry, Henry Guillaume, Dmitry Gutov, DougGwyn, Bruno Haible, Kenichi Handa, Lars Hansen, Chris Hanson, Jesper Harder, Alexan-dru Harsanyi, K. Shane Hartman, John Heidemann, Jon K. Hellan, Magnus Henoch, MarkusHeritsch, Dirk Herrmann, Karl Heuer, Manabu Higashida, Konrad Hinsen, Anders Holst,Jeffrey C. Honig, Tassilo Horn, Kurt Hornik, Tom Houlder, Joakim Hove, Denis Howe, LarsIngebrigtsen, Andrew Innes, Seiichiro Inoue, Philip Jackson, Martyn Jago, Pavel Janik,Paul Jarc, Ulf Jasper, Thorsten Jolitz, Michael K. Johnson, Kyle Jones, Terry Jones, Si-mon Josefsson, Alexandre Julliard, Arne Jrgensen, Tomoji Kagatani, Brewster Kahle,Tokuya Kameshima, Lute Kamstra, Ivan Kanis, David Kastrup, David Kaufman, HenryKautz, Taichi Kawabata, Taro Kawagishi, Howard Kaye, Michael Kifer, Richard King, Pe-ter Kleiweg, Karel Klc, Shuhei Kobayashi, Pavel Kobyakov, Larry K. Kolodney, David M.Koppelman, Koseki Yoshinori, Robert Krawitz, Sebastian Kremer, Ryszard Kubiak, IgorKuzmin, David Kagedal, 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, JuriLinkov, Francis Litterio, Sergey Litvinov, Leo Liu, Emilio C. Lopes, Martin Lorentzon,Dave Love, Eric Ludlam, Karoly Lorentey, Sascha Ludecke, Greg McGary, Roland Mc-Grath, Michael McNamara, Alan Mackenzie, Christopher J. Madsen, Neil M. Mager, KenManheimer, 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, LawrenceMitchell, Richard Mlynarik, Gerd Mollmann, Dani Moncayo, Stefan Monnier, Keith Moore,Jan Moringen, Morioka Tomohiko, Glenn Morris, Don Morrison, Diane Murray, RiccardoMurri, Sen Nagata, Erik Naggum, Gergely Nagy, Nobuyoshi Nakada, Thomas Neumann,Mike Newton, Thien-Thi Nguyen, Jurgen Nickelsen, Dan Nicolaescu, Hrvoje Niksic, JeffNorden, Andrew Norman, Edward OConnor, Kentaro Ohkouchi, Christian Ohler, KenichiOkada, Alexandre Oliva, Bob Olson, Michael Olson, Takaaki Ota, Pieter E. J. Pareit, Ross

  • 4

    Patterson, David Pearson, Juan Pechiar, Jeff Peck, Damon Anton Permezel, Tom Per-rine, William M. Perry, Per Persson, Jens Petersen, Daniel Pfeiffer, Justus Piater, RichardL. Pieri, Fred Pierresteguy, Francois Pinard, Daniel Pittman, Christian Plaunt, Alexan-der Pohoyda, David Ponce, Francesco A. Potort, Michael D. Prange, Mukesh Prasad,Ken Raeburn, Marko Rahamaa, Ashwin Ram, Eric S. Raymond, Paul Reilly, EdwardM. Reingold, David Reitter, Alex Rezinsky, Rob Riepel, Lara Rios, Adrian Robert, NickRoberts, Roland B. Roberts, John Robinson, Denis B. Roegel, Danny Roozendaal, Sebas-tian Rose, William Rosenblatt, Markus Rost, Guillermo J. Rozas, Martin Rudalics, IvarRummelhoff, Jason Rumney, Wolfgang Rupprecht, Benjamin Rutt, Kevin Ryde, James B.Salem, Masahiko Sato, Timo Savola, Jorgen Schafer, Holger Schauer, William Schelter,Ralph Schleicher, Gregor Schmid, Michael Schmidt, Ronald S. Schnell, Philippe Schnoebe-len, Jan Schormann, Alex Schroeder, Stefan Schoef, Rainer Schopf, Raymond Scholz, EricSchulte, Andreas Schwab, Randal Schwartz, Oliver Seidel, Manuel Serrano, Paul Sexton,Hovav Shacham, Stanislav Shalunov, Marc Shapiro, Richard Sharman, Olin Shivers, TiborSimko, Espen Skoglund, Rick Sladkey, Lynn Slater, Chris Smith, David Smith, Paul D.Smith, Wilson Snyder, William Sommerfeld, Simon South, Andre Spiegel, Michael Staats,Thomas Steffen, Ulf Stegemann, Reiner Steib, Sam Steingold, Ake Stenhoff, Peter Stephen-son, Ken Stevens, Andy Stewart, Jonathan Stigelman, Martin Stjernholm, Kim F. Storm,Steve Strassmann, Christopher Suckling, Olaf Sylvester, Naoto Takahashi, Steven Tamm,Jan Tatarik, Luc Teirlinck, Jean-Philippe Theberge, Jens T. Berger Thielemann, SpencerThomas, Jim Thompson, Toru Tomabechi, David OToole, Markus Triska, Tom Tromey,Enami Tsugutomo, Eli Tziperman, Daiki Ueno, Masanobu Umeda, Rajesh Vaidheeswar-ran, Neil W. Van Dyke, Didier Verna, Joakim Verona, Ulrik Vieth, Geoffrey Voelker, JohanVromans, Inge Wallin, John Paul Wallington, Colin Walters, Barry Warsaw, ChristophWedler, Ilja Weis, Zhang Weize, Morten Welinder, Joseph Brian Wells, Rodney Whitby,John Wiegley, Sascha Wilde, Ed Wilkinson, Mike Williams, Roland Winkler, Bill Wohler,Steven A. Wood, Dale R. Worley, Francis J. Wright, Felix S. T. Wu, Tom Wurgler, Ya-mamoto Mitsuharu, Katsumi Yamaoka, Masatake Yamato, Jonathan Yavner, Ryan Yeske,Ilya Zakharevich, Milan Zamazal, Victor Zandy, Eli Zaretskii, Jamie Zawinski, AndrewZhilin, Shenghuo Zhu, Piotr Zielinski, Ian T. Zimmermann, Reto Zimmermann, Neal Zir-ing, Teodor Zlatanov, and Detlev Zundel.

  • 5

    Introduction

    You are reading about GNU Emacs, the GNU incarnation of the advanced, self-documenting, customizable, extensible editor Emacs. (The G in GNU (GNUs Not Unix)is not silent.)

    We call Emacs advanced because it can do much more than simple insertion and deletionof text. It can control subprocesses, indent programs automatically, show multiple files atonce, and more. Emacs editing commands operate in terms of characters, words, lines, sen-tences, paragraphs, and pages, as well as expressions and comments in various programminglanguages.

    Self-documenting means that at any time you can use special commands, known as helpcommands, to find out what your options are, or to find out what any command does, orto find all the commands that pertain to a given topic. See Chapter 7 [Help], page 38.

    Customizable means that you can easily alter the behavior of Emacs commands in simpleways. For instance, if you use a programming language in which comments start with , you can tell the Emacs comment manipulation commands to use thosestrings (see Section 23.5 [Comments], page 258). To take another example, you can rebindthe basic cursor motion commands (up, down, left and right) to any keys on the keyboardthat you find comfortable. See Chapter 33 [Customization], page 429.

    Extensible means that you can go beyond simple customization and create entirely newcommands. New commands are simply programs written in the Lisp language, which are runby Emacss own Lisp interpreter. Existing commands can even be redefined in the middleof an editing session, without having to restart Emacs. Most of the editing commands inEmacs are written in Lisp; the few exceptions could have been written in Lisp but use Cinstead for efficiency. Writing an extension is programming, but non-programmers can useit afterwards. See Section Preface in An Introduction to Programming in Emacs Lisp, ifyou want to learn Emacs Lisp programming.

  • 6

    1 The Organization of the Screen

    On a graphical display, such as on GNU/Linux using the X Window System, Emacs occupiesa graphical window. On a text terminal, Emacs occupies the entire terminal screen. Wewill use the term frame to mean a graphical window or terminal screen occupied by Emacs.Emacs behaves very similarly on both kinds of frames. It normally starts out with just oneframe, but you can create additional frames if you wish (see Chapter 18 [Frames], page 170).

    Each frame consists of several distinct regions. At the top of the frame is a menu bar,which allows you to access commands via a series of menus. On a graphical display, directlybelow the menu bar is a tool bar, a row of icons that perform editing commands if you clickon them. At the very bottom of the frame is an echo area, where informative messages aredisplayed and where you enter information when Emacs asks for it.

    The main area of the frame, below the tool bar (if one exists) and above the echo area, iscalled the window. Henceforth in this manual, we will use the word window in this sense.Graphical display systems commonly use the word window with a different meaning; but,as stated above, we refer to those graphical windows as frames.

    An Emacs window is where the bufferthe text you are editingis displayed. On agraphical display, the window possesses a scroll bar on one side, which can be used toscroll through the buffer. The last line of the window is a mode line. This displays variousinformation about what is going on in the buffer, such as whether there are unsaved changes,the editing modes that are in use, the current line number, and so forth.

    When you start Emacs, there is normally only one window in the frame. However, youcan subdivide this window horizontally or vertically to create multiple windows, each ofwhich can independently display a buffer (see Chapter 17 [Windows], page 163).

    At any time, one window is the selected window. On a graphical display, the selectedwindow shows a more prominent cursor (usually solid and blinking); other windows show aless prominent cursor (usually a hollow box). On a text t