gnu emacs manual: for version 22

561
GNU Emacs Manual

Upload: richard-m-stallman

Post on 08-Dec-2016

222 views

Category:

Documents


1 download

TRANSCRIPT

  • GNU Emacs Manual

  • GNU Emacs Manual

    Sixteenth Edition, Updated for Emacs Version 22.1.

    Richard Stallman

  • This is the Sixteenth edition of the GNU Emacs Manual,updated for Emacs version 22.1.Copyright c 1985, 1986, 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.

    Permission is granted to copy, distribute and/or modify this document underthe terms of the GNU Free Documentation License, Version 1.2 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 freedom to copy and modifythis GNU Manual, like GNU software. Copies published by the Free SoftwareFoundation raise funds for GNU development.

    Published by the Free Software Foundation51 Franklin Street, Fifth FloorBoston, MA 02110-1301 USAISBN 1-882114-86-8

    Cover art by Etienne Suvasa.

  • iShort Contents

    Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 The Organization of the Screen . . . . . . . . . . . . . . . . . . . . . . . . . . 62 Characters, Keys and Commands . . . . . . . . . . . . . . . . . . . . . . . 113 Entering and Exiting Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 Basic Editing Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 The Minibuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 Running Commands by Name . . . . . . . . . . . . . . . . . . . . . . . . . . 357 Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368 The Mark and the Region . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459 Killing and Moving Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5110 Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6011 Controlling the Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6412 Searching and Replacement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8013 Commands for Fixing Typos . . . . . . . . . . . . . . . . . . . . . . . . . . . 9714 Keyboard Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10315 File Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11116 Using Multiple Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14517 Multiple Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15418 Frames and Graphical Displays . . . . . . . . . . . . . . . . . . . . . . . . 15919 International Character Set Support . . . . . . . . . . . . . . . . . . . . 17320 Major Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19221 Indentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19522 Commands for Human Languages . . . . . . . . . . . . . . . . . . . . . . 19823 Editing Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23324 Compiling and Testing Programs . . . . . . . . . . . . . . . . . . . . . . . 25425 Maintaining Large Programs . . . . . . . . . . . . . . . . . . . . . . . . . . 27226 Abbrevs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28227 Sending Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28828 Reading Mail with Rmail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29729 Dired, the Directory Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . 31530 The Calendar and the Diary . . . . . . . . . . . . . . . . . . . . . . . . . . 32931 Miscellaneous Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34932 Customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377

  • ii

    33 Dealing with Common Problems . . . . . . . . . . . . . . . . . . . . . . . 409A GNU GENERAL PUBLIC LICENSE . . . . . . . . . . . . . . . . . . . 423B GNU Free Documentation License . . . . . . . . . . . . . . . . . . . . . . 429C Command Line Arguments for Emacs Invocation . . . . . . . . . . 436D X Options and Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452E Emacs 21 Antinews . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458F Emacs and Mac OS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462G Emacs and Microsoft Windows/MS-DOS . . . . . . . . . . . . . . . . 467The GNU Manifesto . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482Key (Character) Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504Command and Function Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512Variable Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523Concept Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529

  • 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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

    2 Characters, Keys and Commands . . . . . . . . . . . . 112.1 Kinds of User Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.2 Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122.3 Keys and Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132.4 Character Set for Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

    3 Entering and Exiting Emacs . . . . . . . . . . . . . . . . . . 153.1 Exiting Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

    4 Basic Editing Commands . . . . . . . . . . . . . . . . . . . . . 184.1 Inserting Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184.2 Changing the Location of Point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194.3 Erasing Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.4 Undoing Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214.5 Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224.6 Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224.7 Blank Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224.8 Continuation Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234.9 Cursor Position Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234.10 Numeric Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254.11 Repeating a Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

  • iv

    5 The Minibuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285.1 Minibuffers for File Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285.2 Editing in the Minibuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295.3 Completion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

    5.3.1 Completion Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305.3.2 Completion Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305.3.3 Strict Completion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315.3.4 Completion Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

    5.4 Minibuffer History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325.5 Repeating Minibuffer Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

    6 Running Commands by Name . . . . . . . . . . . . . . . 35

    7 Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367.1 Documentation for a Key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387.2 Help by Command or Variable Name . . . . . . . . . . . . . . . . . . . . . . . . . . 387.3 Apropos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397.4 Help Mode Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417.5 Keyword Search for Lisp Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417.6 Help for International Language Support . . . . . . . . . . . . . . . . . . . . . . 427.7 Other Help Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427.8 Help Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437.9 Help on Active Text and Tooltips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

    8 The Mark and the Region . . . . . . . . . . . . . . . . . . . . 458.1 Setting the Mark . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458.2 Transient Mark Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468.3 Using Transient Mark Mode Momentarily . . . . . . . . . . . . . . . . . . . . . 488.4 Operating on the Region . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488.5 Commands to Mark Textual Objects . . . . . . . . . . . . . . . . . . . . . . . . . . 488.6 The Mark Ring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498.7 The Global Mark Ring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

    9 Killing and Moving Text . . . . . . . . . . . . . . . . . . . . . . 519.1 Deletion and Killing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

    9.1.1 Deletion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519.1.2 Killing by Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529.1.3 Other Kill Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

    9.2 Yanking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539.2.1 The Kill Ring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549.2.2 Appending Kills . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549.2.3 Yanking Earlier Kills . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

    9.3 Accumulating Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569.4 Rectangles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579.5 CUA Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

  • v10 Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6010.1 Saving Positions in Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6010.2 Saving Text in Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6010.3 Saving Rectangles in Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6110.4 Saving Window Configurations in Registers . . . . . . . . . . . . . . . . . . . 6110.5 Keeping Numbers in Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6110.6 Keeping File Names in Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6210.7 Bookmarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

    11 Controlling the Display . . . . . . . . . . . . . . . . . . . . . . 6411.1 Scrolling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6411.2 Automatic Scrolling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6511.3 Horizontal Scrolling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6611.4 Follow Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6711.5 Using Multiple Typefaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6711.6 Standard Faces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6811.7 Font Lock mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7011.8 Interactive Highlighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7211.9 Window Fringes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7311.10 Displaying Boundaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7411.11 Useless Whitespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7411.12 Selective Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7511.13 Optional Mode Line Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7511.14 How Text Is Displayed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7611.15 Displaying the Cursor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7711.16 Truncation of Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7811.17 Customization of Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

    12 Searching and Replacement . . . . . . . . . . . . . . . . . 8012.1 Incremental Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

    12.1.1 Basics of Incremental Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8012.1.2 Repeating Incremental Search . . . . . . . . . . . . . . . . . . . . . . . . . . . 8112.1.3 Errors in Incremental Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8112.1.4 Special Input for Incremental Search . . . . . . . . . . . . . . . . . . . . 8212.1.5 Isearch for Non-ASCII Characters . . . . . . . . . . . . . . . . . . . . . . . . 8212.1.6 Isearch Yanking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8212.1.7 Lazy Search Highlighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8312.1.8 Scrolling During Incremental Search . . . . . . . . . . . . . . . . . . . . . 8312.1.9 Slow Terminal Incremental Search . . . . . . . . . . . . . . . . . . . . . . . 84

    12.2 Nonincremental Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8412.3 Word Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8412.4 Regular Expression Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8512.5 Syntax of Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8612.6 Backslash in Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8912.7 Regular Expression Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9112.8 Searching and Case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9112.9 Replacement Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

  • vi

    12.9.1 Unconditional Replacement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9212.9.2 Regexp Replacement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9212.9.3 Replace Commands and Case . . . . . . . . . . . . . . . . . . . . . . . . . . . 9312.9.4 Query Replace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94

    12.10 Other Search-and-Loop Commands . . . . . . . . . . . . . . . . . . . . . . . . . 95

    13 Commands for Fixing Typos . . . . . . . . . . . . . . . . 9713.1 Undo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9713.2 Killing Your Mistakes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9813.3 Transposing Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9913.4 Case Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9913.5 Checking and Correcting Spelling . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

    14 Keyboard Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . 10314.1 Basic Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10314.2 The Keyboard Macro Ring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10514.3 The Keyboard Macro Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10614.4 Executing Macros with Variations . . . . . . . . . . . . . . . . . . . . . . . . . . . 10714.5 Naming and Saving Keyboard Macros . . . . . . . . . . . . . . . . . . . . . . . 10714.6 Editing a Keyboard Macro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10814.7 Stepwise Editing a Keyboard Macro . . . . . . . . . . . . . . . . . . . . . . . . . 109

    15 File Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11115.1 File Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11115.2 Visiting Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11215.3 Saving Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115

    15.3.1 Commands for Saving Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11515.3.2 Backup Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117

    15.3.2.1 Numbered Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11715.3.2.2 Single or Numbered Backups . . . . . . . . . . . . . . . . . . . . . . 11815.3.2.3 Automatic Deletion of Backups . . . . . . . . . . . . . . . . . . . . 11815.3.2.4 Copying vs. Renaming . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119

    15.3.3 Customizing Saving of Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11915.3.4 Protection against Simultaneous Editing . . . . . . . . . . . . . . . . 12015.3.5 Shadowing Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12115.3.6 Updating Time Stamps Automatically . . . . . . . . . . . . . . . . . . 122

    15.4 Reverting a Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12215.5 Auto-Saving: Protection Against Disasters . . . . . . . . . . . . . . . . . . 123

    15.5.1 Auto-Save Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12315.5.2 Controlling Auto-Saving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12415.5.3 Recovering Data from Auto-Saves . . . . . . . . . . . . . . . . . . . . . . 124

    15.6 File Name Aliases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12515.7 Version Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125

    15.7.1 Introduction to Version Control . . . . . . . . . . . . . . . . . . . . . . . . 12615.7.1.1 Supported Version Control Systems . . . . . . . . . . . . . . . . 12615.7.1.2 Concepts of Version Control . . . . . . . . . . . . . . . . . . . . . . . 12715.7.1.3 Types of Log File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128

  • vii

    15.7.2 Version Control and the Mode Line . . . . . . . . . . . . . . . . . . . . 12815.7.3 Basic Editing under Version Control . . . . . . . . . . . . . . . . . . . . 128

    15.7.3.1 Basic Version Control with Locking . . . . . . . . . . . . . . . . 12915.7.3.2 Basic Version Control without Locking . . . . . . . . . . . . 12915.7.3.3 Advanced Control in C-x v v . . . . . . . . . . . . . . . . . . . . . . 13015.7.3.4 Features of the Log Entry Buffer . . . . . . . . . . . . . . . . . . 130

    15.7.4 Examining And Comparing Old Versions . . . . . . . . . . . . . . . 13115.7.5 The Secondary Commands of VC . . . . . . . . . . . . . . . . . . . . . . 132

    15.7.5.1 Registering a File for Version Control . . . . . . . . . . . . . . 13215.7.5.2 VC Status Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13315.7.5.3 Undoing Version Control Actions . . . . . . . . . . . . . . . . . . 134

    15.7.6 Multiple Branches of a File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13415.7.6.1 Switching between Branches . . . . . . . . . . . . . . . . . . . . . . . 13515.7.6.2 Creating New Branches . . . . . . . . . . . . . . . . . . . . . . . . . . . 13515.7.6.3 Merging Branches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13515.7.6.4 Multi-User Branching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136

    15.8 File Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13715.9 Comparing Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13815.10 Diff Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13815.11 Miscellaneous File Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13915.12 Accessing Compressed Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14015.13 File Archives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14115.14 Remote Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14115.15 Quoted File Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14215.16 File Name Cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14315.17 Convenience Features for Finding Files . . . . . . . . . . . . . . . . . . . . . 14415.18 Filesets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

    16 Using Multiple Buffers . . . . . . . . . . . . . . . . . . . . . 14516.1 Creating and Selecting Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14516.2 Listing Existing Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14616.3 Miscellaneous Buffer Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14716.4 Killing Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14816.5 Operating on Several Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14916.6 Indirect Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15116.7 Convenience Features and Customization of Buffer Handling

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15116.7.1 Making Buffer Names Unique . . . . . . . . . . . . . . . . . . . . . . . . . . 15216.7.2 Switching Between Buffers using Substrings . . . . . . . . . . . . 15216.7.3 Customizing Buffer Menus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152

  • viii

    17 Multiple Windows . . . . . . . . . . . . . . . . . . . . . . . . . . 15417.1 Concepts of Emacs Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15417.2 Splitting Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15417.3 Using Other Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15517.4 Displaying in Another Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15617.5 Forcing Display in the Same Window . . . . . . . . . . . . . . . . . . . . . . . . 15617.6 Deleting and Rearranging Windows . . . . . . . . . . . . . . . . . . . . . . . . . 15717.7 Window Handling Convenience Features and Customization

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

    18 Frames and Graphical Displays . . . . . . . . . . . . 15918.1 Killing and Yanking on Graphical Displays . . . . . . . . . . . . . . . . . . 159

    18.1.1 Mouse Commands for Editing . . . . . . . . . . . . . . . . . . . . . . . . . . 15918.1.2 Cut and Paste with Other Window Applications . . . . . . . . 16118.1.3 Mouse Commands for Words and Lines . . . . . . . . . . . . . . . . . 16118.1.4 Secondary Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16118.1.5 Using the Clipboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162

    18.2 Following References with the Mouse . . . . . . . . . . . . . . . . . . . . . . . . 16218.3 Mouse Clicks for Menus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16318.4 Mode Line Mouse Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16418.5 Creating Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16418.6 Frame Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16518.7 Speedbar Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16618.8 Multiple Displays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16618.9 Special Buffer Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16718.10 Setting Frame Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16818.11 Scroll Bars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16818.12 Scrolling With Wheeled Mice . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16918.13 Drag and Drop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16918.14 Menu Bars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17018.15 Tool Bars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17018.16 Using Dialog Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17018.17 Tooltips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17118.18 Mouse Avoidance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17118.19 Non-Window Terminals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17118.20 Using a Mouse in Terminal Emulators . . . . . . . . . . . . . . . . . . . . . . 172

    19 International Character Set Support . . . . . . 17319.1 Introduction to International Character Sets . . . . . . . . . . . . . . . . 17319.2 Enabling Multibyte Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17419.3 Language Environments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17519.4 Input Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17619.5 Selecting an Input Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17819.6 Unibyte and Multibyte Non-ASCII characters . . . . . . . . . . . . . . . . 17919.7 Coding Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17919.8 Recognizing Coding Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18119.9 Specifying a Files Coding System . . . . . . . . . . . . . . . . . . . . . . . . . . . 183

  • ix

    19.10 Choosing Coding Systems for Output . . . . . . . . . . . . . . . . . . . . . . 18319.11 Specifying a Coding System for File Text . . . . . . . . . . . . . . . . . . 18419.12 Coding Systems for Interprocess Communication . . . . . . . . . . . 18519.13 Coding Systems for File Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18619.14 Coding Systems for Terminal I/O . . . . . . . . . . . . . . . . . . . . . . . . . . 18719.15 Fontsets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18719.16 Defining fontsets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18819.17 Undisplayable Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18919.18 Unibyte Editing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19019.19 Charsets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191

    20 Major Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19220.1 How Major Modes are Chosen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192

    21 Indentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19521.1 Indentation Commands and Techniques . . . . . . . . . . . . . . . . . . . . . 19621.2 Tab Stops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19621.3 Tabs vs. Spaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197

    22 Commands for Human Languages . . . . . . . . . 19822.1 Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19822.2 Sentences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19922.3 Paragraphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20022.4 Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20122.5 Filling Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202

    22.5.1 Auto Fill Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20222.5.2 Explicit Fill Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20322.5.3 The Fill Prefix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20422.5.4 Adaptive Filling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20522.5.5 Refill Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20622.5.6 Long Lines Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206

    22.6 Case Conversion Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20722.7 Text Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20822.8 Outline Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209

    22.8.1 Format of Outlines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20922.8.2 Outline Motion Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21022.8.3 Outline Visibility Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . 21122.8.4 Viewing One Outline in Multiple Views . . . . . . . . . . . . . . . . 21222.8.5 Folding Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212

    22.9 TEX Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21422.9.1 TEX Editing Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21422.9.2 LaTEX Editing Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21522.9.3 TEX Printing Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21522.9.4 TEX Mode Miscellany . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218

    22.10 SGML, XML, and HTML Modes . . . . . . . . . . . . . . . . . . . . . . . . . . 21822.11 Nroff Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21922.12 Editing Formatted Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219

  • x22.12.1 Requesting to Edit Formatted Text . . . . . . . . . . . . . . . . . . . 22022.12.2 Hard and Soft Newlines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22022.12.3 Editing Format Information . . . . . . . . . . . . . . . . . . . . . . . . . . . 22122.12.4 Faces in Formatted Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22122.12.5 Colors in Formatted Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22222.12.6 Indentation in Formatted Text . . . . . . . . . . . . . . . . . . . . . . . . 22322.12.7 Justification in Formatted Text . . . . . . . . . . . . . . . . . . . . . . . 22422.12.8 Setting Other Text Properties . . . . . . . . . . . . . . . . . . . . . . . . . 22522.12.9 Forcing Enriched Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225

    22.13 Editing Text-based Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22522.13.1 What is a Text-based Table? . . . . . . . . . . . . . . . . . . . . . . . . . . 22622.13.2 How to Create a Table? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22722.13.3 Table Recognition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22722.13.4 Commands for Table Cells . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22822.13.5 Cell Justification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22822.13.6 Commands for Table Rows . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22922.13.7 Commands for Table Columns . . . . . . . . . . . . . . . . . . . . . . . . 22922.13.8 Fix Width of Cells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22922.13.9 Conversion Between Plain Text and Tables . . . . . . . . . . . . 23022.13.10 Analyzing Table Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . 23122.13.11 Table Miscellany . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231

    23 Editing Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . 23323.1 Major Modes for Programming Languages . . . . . . . . . . . . . . . . . . 23323.2 Top-Level Definitions, or Defuns . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234

    23.2.1 Left Margin Convention . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23423.2.2 Moving by Defuns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23523.2.3 Imenu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23523.2.4 Which Function Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236

    23.3 Indentation for Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23623.3.1 Basic Program Indentation Commands . . . . . . . . . . . . . . . . . 23623.3.2 Indenting Several Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23723.3.3 Customizing Lisp Indentation . . . . . . . . . . . . . . . . . . . . . . . . . . 23823.3.4 Commands for C Indentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 23823.3.5 Customizing C Indentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239

    23.4 Commands for Editing with Parentheses . . . . . . . . . . . . . . . . . . . . 23923.4.1 Expressions with Balanced Parentheses . . . . . . . . . . . . . . . . . 24023.4.2 Moving in the Parenthesis Structure . . . . . . . . . . . . . . . . . . . . 24123.4.3 Automatic Display Of Matching Parentheses . . . . . . . . . . . 241

    23.5 Manipulating Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24223.5.1 Comment Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24223.5.2 Multiple Lines of Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . 24423.5.3 Options Controlling Comments . . . . . . . . . . . . . . . . . . . . . . . . . 244

    23.6 Documentation Lookup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24523.6.1 Info Documentation Lookup . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24523.6.2 Man Page Lookup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24523.6.3 Emacs Lisp Documentation Lookup . . . . . . . . . . . . . . . . . . . . 246

    23.7 Hideshow minor mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247

  • xi

    23.8 Completion for Symbol Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24823.9 Glasses minor mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24823.10 Other Features Useful for Editing Programs . . . . . . . . . . . . . . . . 24823.11 C and Related Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249

    23.11.1 C Mode Motion Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . 24923.11.2 Electric C Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25023.11.3 Hungry Delete Feature in C . . . . . . . . . . . . . . . . . . . . . . . . . . . 25023.11.4 Other Commands for C Mode . . . . . . . . . . . . . . . . . . . . . . . . . 251

    23.12 Asm Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252

    24 Compiling and Testing Programs . . . . . . . . . . 25424.1 Running Compilations under Emacs . . . . . . . . . . . . . . . . . . . . . . . . . 25424.2 Compilation Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25524.3 Subshells for Compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25724.4 Searching with Grep under Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . 25724.5 Finding Syntax Errors On The Fly . . . . . . . . . . . . . . . . . . . . . . . . . . 25824.6 Running Debuggers Under Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . 259

    24.6.1 Starting GUD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25924.6.2 Debugger Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26024.6.3 Commands of GUD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26124.6.4 GUD Customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26324.6.5 GDB Graphical Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263

    24.6.5.1 GDB User Interface Layout . . . . . . . . . . . . . . . . . . . . . . . 26424.6.5.2 Source Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26424.6.5.3 Breakpoints Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26524.6.5.4 Stack Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26524.6.5.5 Other Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26624.6.5.6 Watch Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267

    24.7 Executing Lisp Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26724.8 Libraries of Lisp Code for Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26824.9 Evaluating Emacs Lisp Expressions . . . . . . . . . . . . . . . . . . . . . . . . . 26924.10 Lisp Interaction Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27024.11 Running an External Lisp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270

    25 Maintaining Large Programs . . . . . . . . . . . . . . . 27225.1 Change Logs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27225.2 Format of ChangeLog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27225.3 Tags Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273

    25.3.1 Source File Tag Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27325.3.2 Creating Tags Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27525.3.3 Etags Regexps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27725.3.4 Selecting a Tags Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27825.3.5 Finding a Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27925.3.6 Searching and Replacing with Tags Tables . . . . . . . . . . . . . . 28025.3.7 Tags Table Inquiries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281

  • xii

    26 Abbrevs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28226.1 Abbrev Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28226.2 Defining Abbrevs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28226.3 Controlling Abbrev Expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28326.4 Examining and Editing Abbrevs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28426.5 Saving Abbrevs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28526.6 Dynamic Abbrev Expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28626.7 Customizing Dynamic Abbreviation . . . . . . . . . . . . . . . . . . . . . . . . . 287

    27 Sending Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28827.1 The Format of the Mail Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28827.2 Mail Header Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28927.3 Mail Aliases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29127.4 Mail Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292

    27.4.1 Mail Sending . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29227.4.2 Mail Header Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29327.4.3 Citing Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29427.4.4 Mail Mode Miscellany . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294

    27.5 Mail Amusements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29527.6 Mail-Composition Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296

    28 Reading Mail with Rmail . . . . . . . . . . . . . . . . . . 29728.1 Basic Concepts of Rmail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29728.2 Scrolling Within a Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29728.3 Moving Among Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29828.4 Deleting Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29928.5 Rmail Files and Inboxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30028.6 Multiple Rmail Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30128.7 Copying Messages Out to Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30228.8 Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30328.9 Rmail Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30428.10 Sending Replies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30528.11 Summaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306

    28.11.1 Making Summaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30728.11.2 Editing in Summaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307

    28.12 Sorting the Rmail File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30828.13 Display of Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30928.14 Rmail and Coding Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31028.15 Editing Within a Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31128.16 Digest Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31128.17 Converting an Rmail File to Inbox Format . . . . . . . . . . . . . . . . . 31128.18 Reading Rot13 Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31228.19 movemail program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31228.20 Retrieving Mail from Remote Mailboxes . . . . . . . . . . . . . . . . . . . . 31328.21 Retrieving Mail from Local Mailboxes in Various Formats . . 314

  • xiii

    29 Dired, the Directory Editor . . . . . . . . . . . . . . . . 31529.1 Entering Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31529.2 Navigation in the Dired Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31529.3 Deleting Files with Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31629.4 Flagging Many Files at Once . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31629.5 Visiting Files in Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31729.6 Dired Marks vs. Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31829.7 Operating on Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31929.8 Shell Commands in Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32129.9 Transforming File Names in Dired . . . . . . . . . . . . . . . . . . . . . . . . . . 32229.10 File Comparison with Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32329.11 Subdirectories in Dired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32429.12 Moving Over Subdirectories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32429.13 Hiding Subdirectories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32529.14 Updating the Dired Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32529.15 Dired and find . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32629.16 Editing the Dired Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32629.17 Viewing Image Thumbnails in Dired . . . . . . . . . . . . . . . . . . . . . . . 32729.18 Other Dired Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328

    30 The Calendar and the Diary . . . . . . . . . . . . . . . 32930.1 Movement in the Calendar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329

    30.1.1 Motion by Standard Lengths of Time . . . . . . . . . . . . . . . . . . . 32930.1.2 Beginning or End of Week, Month or Year . . . . . . . . . . . . . . 33030.1.3 Specified Dates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330

    30.2 Scrolling in the Calendar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33130.3 Counting Days . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33130.4 Miscellaneous Calendar Commands . . . . . . . . . . . . . . . . . . . . . . . . . 33130.5 Writing Calendar Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33230.6 Holidays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33330.7 Times of Sunrise and Sunset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33430.8 Phases of the Moon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33530.9 Conversion To and From Other Calendars . . . . . . . . . . . . . . . . . . . 336

    30.9.1 Supported Calendar Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . 33630.9.2 Converting To Other Calendars . . . . . . . . . . . . . . . . . . . . . . . . 33730.9.3 Converting From Other Calendars . . . . . . . . . . . . . . . . . . . . . . 33830.9.4 Converting from the Mayan Calendar . . . . . . . . . . . . . . . . . . 339

    30.10 The Diary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34030.10.1 Displaying the Diary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34030.10.2 The Diary File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34130.10.3 Date Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34230.10.4 Commands to Add to the Diary . . . . . . . . . . . . . . . . . . . . . . . 34330.10.5 Special Diary Entries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344

    30.11 Appointments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34530.12 Importing and Exporting Diary Entries . . . . . . . . . . . . . . . . . . . . 34630.13 Daylight Saving Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34630.14 Summing Time Intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347

  • xiv

    31 Miscellaneous Commands . . . . . . . . . . . . . . . . . . 34931.1 Gnus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349

    31.1.1 Gnus Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34931.1.2 When Gnus Starts Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34931.1.3 Summary of Gnus Commands . . . . . . . . . . . . . . . . . . . . . . . . . . 350

    31.2 Running Shell Commands from Emacs . . . . . . . . . . . . . . . . . . . . . . 35131.2.1 Single Shell Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35131.2.2 Interactive Inferior Shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35231.2.3 Shell Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35331.2.4 Shell Prompts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35531.2.5 Shell Command History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356

    31.2.5.1 Shell History Ring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35631.2.5.2 Shell History Copying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35731.2.5.3 Shell History References . . . . . . . . . . . . . . . . . . . . . . . . . . . 357

    31.2.6 Directory Tracking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35831.2.7 Shell Mode Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35831.2.8 Emacs Terminal Emulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35931.2.9 Term Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36031.2.10 Page-At-A-Time Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36031.2.11 Remote Host Shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360

    31.3 Using Emacs as a Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36031.3.1 Invoking emacsclient . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362

    31.4 Printing Hard Copies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36331.5 PostScript Hardcopy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36331.6 Variables for PostScript Hardcopy . . . . . . . . . . . . . . . . . . . . . . . . . . . 36431.7 Printing Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36531.8 Sorting Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36631.9 Narrowing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36831.10 Two-Column Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36831.11 Editing Binary Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36931.12 Saving Emacs Sessions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37031.13 Recursive Editing Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37131.14 Emulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37131.15 Hyperlinking and Navigation Features . . . . . . . . . . . . . . . . . . . . . . 373

    31.15.1 Following URLs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37331.15.2 Activating URLs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37331.15.3 Finding Files and URLs at Point . . . . . . . . . . . . . . . . . . . . . . 374

    31.16 Dissociated Press . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37531.17 Other Amusements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375

  • xv

    32 Customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37732.1 Minor Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37732.2 Easy Customization Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379

    32.2.1 Customization Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37932.2.2 Browsing and Searching for Options and Faces . . . . . . . . . 38032.2.3 Changing a Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38132.2.4 Saving Customizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38332.2.5 Customizing Faces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38432.2.6 Customizing Specific Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38532.2.7 Customization Themes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386

    32.3 Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38732.3.1 Examining and Setting Variables . . . . . . . . . . . . . . . . . . . . . . . 38732.3.2 Hooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38832.3.3 Local Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38932.3.4 Local Variables in Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390

    32.3.4.1 Specifying File Variables . . . . . . . . . . . . . . . . . . . . . . . . . . 39032.3.4.2 Safety of File Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392

    32.4 Customizing Key Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39332.4.1 Keymaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39332.4.2 Prefix Keymaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39432.4.3 Local Keymaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39532.4.4 Minibuffer Keymaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39532.4.5 Changing Key Bindings Interactively . . . . . . . . . . . . . . . . . . . 39632.4.6 Rebinding Keys in Your Init File . . . . . . . . . . . . . . . . . . . . . . . 39732.4.7 Rebinding Function Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39832.4.8 Named ASCII Control Characters . . . . . . . . . . . . . . . . . . . . . . 39932.4.9 Rebinding Mouse Buttons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40032.4.10 Disabling Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402

    32.5 The Syntax Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40232.6 The Init File, ~/.emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403

    32.6.1 Init File Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40332.6.2 Init File Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40432.6.3 Terminal-specific Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . 40732.6.4 How Emacs Finds Your Init File . . . . . . . . . . . . . . . . . . . . . . . 40732.6.5 Non-ASCII Characters in Init Files . . . . . . . . . . . . . . . . . . . . . 407

    33 Dealing with Common Problems . . . . . . . . . . 40933.1 Quitting and Aborting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40933.2 Dealing with Emacs Trouble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410

    33.2.1 If DEL Fails to Delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41033.2.2 Recursive Editing Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41133.2.3 Garbage on the Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41133.2.4 Garbage in the Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41233.2.5 Running out of Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41233.2.6 Recovery After a Crash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41233.2.7 Emergency Escape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41333.2.8 Help for Total Frustration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414

    33.3 Reporting Bugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414

  • xvi

    33.3.1 When Is There a Bug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41433.3.2 Understanding Bug Reporting . . . . . . . . . . . . . . . . . . . . . . . . . . 41533.3.3 Checklist for Bug Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41633.3.4 Sending Patches for GNU Emacs . . . . . . . . . . . . . . . . . . . . . . . 420

    33.4 Contributing to Emacs Development . . . . . . . . . . . . . . . . . . . . . . . . 42233.5 How To Get Help with GNU Emacs . . . . . . . . . . . . . . . . . . . . . . . . . 422

    Appendix A GNU GENERAL PUBLICLICENSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423

    Preamble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND

    MODIFICATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424How to Apply These Terms to Your New Programs . . . . . . . . . . . . . . . . 428

    Appendix B GNU Free Documentation License. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429

    ADDENDUM: How to use this License for your documents . . . . . . . . 435

    Appendix C Command Line Arguments forEmacs Invocation . . . . . . . . . . . . . . . . . . . . . . . . . . . 436

    C.1 Action Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436C.2 Initial Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437C.3 Command Argument Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439C.4 Resuming Emacs with Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . 439C.5 Environment Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440

    C.5.1 General Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440C.5.2 Miscellaneous Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443C.5.3 The MS-Windows System Registry . . . . . . . . . . . . . . . . . . . . . . 444

    C.6 Specifying the Display Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445C.7 Font Specification Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445C.8 Window Color Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447C.9 Options for Window Size and Position . . . . . . . . . . . . . . . . . . . . . . . 448C.10 Internal and External Borders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450C.11 Frame Titles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450C.12 Icons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451C.13 Other Display Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451

    Appendix D X Options and Resources . . . . . . . 452D.1 X Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452D.2 Table of X Resources for Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453D.3 X Resources for Faces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454D.4 Lucid Menu X Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455D.5 GTK resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456

    Appendix E Emacs 21 Antinews . . . . . . . . . . . . . 458

  • xvii

    Appendix F Emacs and Mac OS . . . . . . . . . . . . . 462F.1 Keyboard and Mouse Input on Mac . . . . . . . . . . . . . . . . . . . . . . . . . . 462F.2 International Character Set Support on Mac . . . . . . . . . . . . . . . . . 463F.3 Environment Variables and Command Line Arguments. . . . . . . 464F.4 Volumes and Directories on Mac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464F.5 Specifying Fonts on Mac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465F.6 Mac-Specific Lisp Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466

    Appendix G Emacs and MicrosoftWindows/MS-DOS . . . . . . . . . . . . . . . . . . . . . . . . . 467

    G.1 Text Files and Binary Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467G.2 File Names on MS-Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468G.3 Emulation of ls on MS-Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469G.4 HOME Directory on MS-Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . 469G.5 Keyboard Usage on MS-Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469G.6 Mouse Usage on MS-Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470G.7 Subprocesses on Windows 9X/ME and Windows NT/2K/XP

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470G.8 Printing and MS-Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471G.9 Miscellaneous Windows-specific features . . . . . . . . . . . . . . . . . . . . . 473

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

    Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482

    Key (Character) Index . . . . . . . . . . . . . . . . . . . . . . . . . . 504

    Command and Function Index . . . . . . . . . . . . . . . . . . 512

    Variable Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523

    Concept Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529

  • Preface 1

    Preface

    This manual documents the use and simple customization of the Emacs editor. 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 are newto Emacs, we recommend you start with the on-line, learn-by-doing tutorial, before readingthe 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.

    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 Trouble chapter if Emacs does not seem to be working properly. It explainshow to cope with several common problems (see Section 33.2 [Lossage], page 410), as wellas when and how to report Emacs bugs (see Section 33.3 [Bugs], page 414).

    To find the documentation of a particular command, look in the index. Keys (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 on-line perusal with the Info program, which is the principal means of accessing on-linedocumentation in the GNU system. Both the Emacs Info file and an Info reader are includedwith GNU Emacs. The Info file and the printed book contain substantially the same textand 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 Emacseditors, all sharing common principles of organization. For information on theunderlying philosophy of Emacs and the lessons learned from its development, seeEmacs, the Extensible, Customizable Self-Documenting Display Editor, available fromftp://publications.ai.mit.edu/ai-publications/pdf/AIM-519A.pdf.

    This edition of the manual is intended for use with GNU Emacs installed on GNU andUnix systems. GNU Emacs can also be used on VMS, MS-DOS (also called MS-DOG),Microsoft Windows, and Macintosh systems. Those systems use different file name syntax;in addition, VMS and MS-DOS do not support all GNU Emacs features. See Appendix G[Microsoft Windows], page 467, for information about using Emacs on Windows. See Ap-pendix F [Mac OS], page 462, for information about using Emacs on Macintosh. We donttry to describe VMS usage in this manual.

  • Distribution 2

    Distribution

    GNU Emacs is free software; this means that everyone is free to use it and free to redistributeit on certain conditions. GNU Emacs is not in the public domain; it is copyrighted and thereare restrictions on its distribution, but these restrictions are designed to permit everythingthat a good cooperating citizen would want to do. What is not allowed is to try to preventothers from further sharing any version of GNU Emacs that they might get from you. Theprecise conditions are found in the GNU General Public License that comes with Emacsand also appears in this manual1. See Appendix A [Copying], page 423.

    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.

    You can also order copies of GNU Emacs from the Free Software Foundation. Thisis a convenient and reliable way to get a copy; it is also a good way to help fund ourwork. We also sell hardcopy versions of this manual and An Introduction to Programmingin Emacs Lisp, by Robert J. Chassell. You can find an order form on our web site athttp://www.gnu.org/order/order.html. For further information, write to

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

    The income from distribution fees goes to support the foundations purpose: the devel-opment of new free software, and improvements to our existing programs including GNUEmacs.

    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. If company policy is unsympathetic to the idea of donating to charity, you mightinstead suggest ordering a CD-ROM from the Foundation occasionally, or subscribing toperiodic updates.

    Acknowledgments

    Contributors to GNU Emacs include Jari Aalto, Per Abrahamsen, Tomas Abrahamsson,Jay K. Adams, Michael Albinus, Nagy Andras, Ralf Angeli, Joe Arceneaux, Miles Bader,

    1 This manual is itself covered by the GNU Free Documentation License. This license is similar in spiritto the General Public License, but is more suitable for documentation. See Appendix B [GNU FreeDocumentation License], page 429.

  • Distribution 3

    David Bakhash, Juanma Barranquero, Eli Barzilay, Steven L. Baur, Jay Belanger, Alexan-der L. Belikoff, Boaz Ben-Zvi, Karl Berry, Anna M. Bigatti, Ray Blaak, Jim Blandy, JohanBockgard, Per Bothner, Terrence Brannon, Frank Bresz, Peter Breton, Emmanuel Briot,Kevin Broadey, Vincent Broman, David M. Brown, Georges Brun-Cottan, Joe Buehler,W lodek Bzyl, Bill Carpenter, Per Cederqvist, Hans Chalupsky, Chris Chase, Bob Chassell,Andrew Choi, Sacha Chua, James Clark, Mike Clarkson, Glynn Clements, Andrew Csillag,Doug Cutting, Mathias Dahl, Satyaki Das, Michael DeCorte, Gary Delp, Matthieu Devin,Eri Ding, Jan Djarv, Carsten Dominik, Scott Draves, Benjamin Drieu, Viktor Dukhovni,John Eaton, Rolf Ebert, Paul Eggert, Stephen Eglen, Torbjorn Einarsson, TsugutomoEnami, Hans Henrik Eriksen, Michael Ernst, Ata Etemadi, Frederick Farnbach, OscarFigueiredo, Fred Fish, Karl Fogel, Gary Foster, Romain Francoise, Noah Friedman, An-dreas Fuchs, Hallvard Furuseth, Keith Gabryelski, Peter S. Galbraith, Kevin Gallagher,Kevin Gallo, Juan Leon Lahoz Garca, Howard Gayle, Stephen Gildea, Julien Gilles, DavidGillespie, Bob Glickstein, Deepak Goel, Boris Goldowsky, Michelangelo Grigni, Odd Gripen-stam, Kai Grojohann, Michael Gschwind, Henry Guillaume, Doug Gwyn, Kenichi Handa,Lars Hansen, Chris Hanson, K. Shane Hartman, John Heidemann, Jon K. Hellan, Jes-per Harder, Markus Heritsch, Karl Heuer, Manabu Higashida, Anders Holst, Jeffrey C.Honig, Kurt Hornik, Tom Houlder, Joakim Hove, Denis Howe, Lars Ingebrigtsen, AndrewInnes, Seiichiro Inoue, Pavel Janik, Paul Jarc, Ulf Jasper, Michael K. Johnson, Kyle Jones,Terry Jones, Simon Josefsson, Arne Jrgensen, Tomoji Kagatani, Brewster Kahle, LuteKamstra, David Kastrup, David Kaufman, Henry Kautz, Taichi Kawabata, Howard Kaye,Michael Kifer, Richard King, Peter Kleiweg, Shuhei Kobayashi, Pavel Kobiakov, Larry K.Kolodney, David M. Koppelman, Koseki Yoshinori, Robert Krawitz, Sebastian Kremer,Ryszard Kubiak, Geoff Kuenning, David Kagedal, Daniel LaLiberte, Mario Lang, AaronLarson, James R. Larus, Vinicius Jose Latorre, Werner Lemberg, Frederic Lepied, PeterLiljenberg, Lars Lindberg, Chris Lindblad, Anders Lindgren, Thomas Link, Juri Linkov,Francis Litterio, Emilio C. Lopes, Dave Love, Sascha Ludecke, Eric Ludlam,Alan Macken-zie, Christopher J. Madsen, Neil M. Mager, Ken Manheimer, Bill Mann, Brian Marick,Simon Marshall, Bengt Martensson, Charlie Martin, Thomas May, Roland McGrath, WillMengarini, David Megginson, Ben A. Mesander, Wayne Mesard, Brad Miller, LawrenceMitchell, Richard Mlynarik, Gerd Moellmann, Stefan Monnier, Morioka Tomohiko, KeithMoore, Glenn Morris, Diane Murray, Sen Nagata, Erik Naggum, Thomas Neumann, Thien-Thi Nguyen, Mike Newton, Jurgen Nickelsen, Dan Nicolaescu, Hrvoje Niksic, Jeff Norden,Andrew Norman, Alexandre Oliva, Bob Olson, Michael Olson, Takaaki Ota, Pieter E. J.Pareit, David Pearson, Jeff Peck, Damon Anton Permezel, Tom Perrine, William M. Perry,Per Persson, Jens Petersen, Daniel Pfeiffer, Richard L. Pieri, Fred Pierresteguy, ChristianPlaunt, David Ponce, Francesco A. Potorti, Michael D. Prange, Mukesh Prasad, Ken Rae-burn, Marko Rahamaa, Ashwin Ram, Eric S. Raymond, Paul Reilly, Edward M. Reingold,Alex Rezinsky, Rob Riepel, David Reitter, Nick Roberts, Roland B. Roberts, John Robin-son, Danny Roozendaal, William Rosenblatt, Guillermo J. Rozas, Martin Rudalics, IvarRummelhoff, Jason Rumney, Wolfgang Rupprecht, Kevin Ryde, James B. Salem, MasahikoSato, Jorgen Schaefer, Holger Schauer, William Schelter, Ralph Schleicher, Gregor Schmid,Michael Schmidt, Ronald S. Schnell, Philippe Schnoebelen, Jan Schormann, Alex Schroeder,Stephen Schoef, Raymond Scholz, Randal Schwartz, Oliver Seidel, Manuel Serrano, Ho-vav Shacham, Stanislav Shalunov, Marc Shapiro, Richard Sharman, Olin Shivers, EspenSkoglund, Rick Sladkey, Lynn Slater, Chris Smith, David Smith, Paul D. Smith, AndreSpiegel, Michael Staats, William Sommerfeld, Michael Staats, Reiner Steib, Sam Steingold,

  • Distribution 4

    Ake Stenhoff, Peter Stephenson, Ken Stevens, Jonathan Stigelman, Martin Stjernholm, KimF. Storm, Steve Strassman, Olaf Sylvester, Naoto Takahashi, Steven Tamm, Jean-PhilippeTheberge, Jens T. Berger Thielemann, Spencer Thomas, Jim Thompson, Luc Teirlinck,Tom Tromey, Enami Tsugutomo, Eli Tziperman, Daiki Ueno, Masanobu Umeda, RajeshVaidheeswarran, Neil W. Van Dyke, Didier Verna, Ulrik Vieth, Geoffrey Voelker, JohanVromans, Inge Wallin, John Paul Wallington, Colin Walters, Barry Warsaw, Morten Welin-der, Joseph Brian Wells, Rodney Whitby, John Wiegley, Ed Wilkinson, Mike Williams, BillWohler, Steven A. Wood, Dale R. Worley, Francis J. Wright, Felix S. T. Wu, Tom Wurgler,Katsumi Yamaoka, Masatake Yamato, Jonathan Yavner, Ryan Yeske, Chong Yidong, IlyaZakharevich, Milan Zamazal, Victor Zandy, Eli Zaretskii, Jamie Zawinski, Shenghuo Zhu,Ian T. Zimmermann, Reto Zimmermann, Neal Ziring, Teodor Zlatanov, and Detlev Zundel.

  • Introduction 5

    Introduction

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

    We call Emacs advanced because it provides much more than simple insertion and dele-tion. It can control subprocesses, indent programs automatically, show two or more filesat once, and edit formatted text. Emacs editing commands operate in terms of characters,words, lines, sentences, paragraphs, and pages, as well as expressions and comments invarious programming languages.

    Self-documenting means that at any time you can type a special character, Control-h,to find out what your options are. You can also use it to find out what any command does,or to find all the commands that pertain to a topic. See Chapter 7 [Help], page 36.

    Customizable means that you can alter Emacs commands behavior in simple ways. Forexample, if you use a programming language in which comments start with , you can tell the Emacs comment manipulation commands to use those strings(see Section 23.5 [Comments], page 242). Another sort of customization is rearrangementof the command set. For example, you can rebind the basic cursor motion commands (up,down, left and right) to any keys on the keyboard that you find comfortable. See Chapter 32[Customization], page 377.

    Extensible means that you can go beyond simple customization and write entirely newcommandsprograms in the Lisp language to be run by Emacss own Lisp interpreter.Emacs is an on-line extensible system, which means that it is divided into many functionsthat call each other, any of which can be redefined in the middle of an editing session.Almost any part of Emacs can be replaced without making a separate copy of all of Emacs.Most of the editing commands of Emacs are written in Lisp; the few exceptions could havebeen written in Lisp but use C instead for efficiency. Writing an extension is programming,but non-programmers can use it afterwards. See section Preface in An Introduction toProgramming in Emacs Lisp, if you want to learn Emacs Lisp programming.

    When running on a graphical display, Emacs provides its own menus and convenienthandling of mouse buttons. In addition, Emacs provides many of the benefits of a graphicaldisplay even on a text-only terminal. For instance, it can highlight parts of a file, displayand edit several files at once, move text between files, and edit files while running shellcommands.

  • Chapter 1: The Organization of the Screen 6

    1 The Organization of the Screen

    On a text-only terminal, the Emacs display occupies the whole screen. On a graphicaldisplay, such as on GNU/Linux using the XWindow System, Emacs creates its own windowsto use. We use the term frame to mean the entire text-only screen or an entire system-levelwindow used by Emacs. Emacs uses both kinds of frames, in the same way, to displayyour editing. Emacs normally starts out with just one frame, but you can create additionalframes if you wish. See Chapter 18 [Frames], page 159.

    When you start Emacs, the main central area of the frame, all except for the top andbottom and sides, displays the text you are editing. This area is called the window. At thetop there is normally a menu bar where you can access a series of menus; then there maybe a tool bar, a row of icons that perform editing commands if you click on them. Belowthis, the window begins, often with a scroll bar on one side. Below the window comes thelast line of the frame, a special echo area or minibuffer window, where prompts appear andyou enter information when Emacs asks for it. See following sections for more informationabout these special lines.

    You can subdivide the window horizontally or vertically to make multiple text windows,each of which can independently display some file or text (see Chapter 17 [Windows],page 154). In this manual, the word window refers to the initial large window if notsubdivided, or any one of the multiple windows you have subdivided it into.

    At any time, one window is the selected window. On graphical displays, the selectedwindow normally shows a more prominent cursor (usually solid and blinking) while otherwindows show a weaker cursor (such as a hollow box). Text terminals have just one cursor,so it always appears in the selected window.

    Most Emacs commands implicitly apply to the text in the selected window; the text inunselected windows is mostly visible for reference. However, mouse commands generallyoperate on whatever window you click them in, whether selected or not. If you use multipleframes on a graphical display, then giving the input focus to a particular frame selects awindow in that frame.

    Each windows last line is a mode line, which describes what is going on in that window.It appears in different color and/or a 3D box if the terminal supports them; its contentsnormally begin with --:-- *scratch* when Emacs starts. The mode line displays statusinformation such as what buffer is being displayed above it in the window, what major andminor modes are in use, and whether the buffer contains unsaved changes.

    1.1 Point

    Within Emacs, the active cursor shows the location at which editing commands will takeeffect. This location is called point. Many Emacs commands move point through the text,so that you can edit at different places in it. You can also place point by clicking mousebutton 1 (normally the left button).

    While the cursor appears to be on a character, you should think of point as between twocharacters; it points before the character that appears under the cursor. For example, ifyour text looks like frob with the cursor over the b, then point is between the o and theb. If you insert the character ! at that position, the result is fro!b, with point betweenthe ! and the b. Thus, the cursor remains over the b, as before.

  • Chapter 1: The Organization of the Screen 7

    Sometimes people speak of the cursor when they mean point, or speak of commandsthat move point as cursor motion commands.

    If you are editing several files in Emacs, each in its own buffer, each buffer has its ownpoint location. A buffer that is not currently displayed remembers its point location in caseyou display it again later. When Emacs displays multiple windows, each window has itsown point location. If the same buffer appears in more than one window, each window hasits own point position in that buffer, and (when possible) its own cursor.

    A text-only terminal has just one cursor, in the selected window. The other windowsdo not show a cursor, even though they do have their own position of point. When Emacsupdates the screen on a text-only terminal, it has to put the cursor temporarily at the placethe output goes. This doesnt mean point is there, though. Once display updating finishes,Emacs puts the cursor where point is.

    On graphical displays, Emacs shows a cursor in each window; the selected windowscursor is solid and blinking, and the other cursors are just hollow. Thus, the most prominentcursor always shows you the selected window, on all kinds of terminals.

    See Section 11.15 [Cursor Display], page 77, for customizable variables that controldisplay of the cursor or cursors.

    The term point comes from the character ., which was the command in TECO(the language in which the original Emacs was written) for accessing the value now calledpoint.

    1.2 The Echo Area

    The line at the bottom of the frame (below the mode line) is the echo area. It is used todisplay small amounts of text for various purposes.

    Echoing means displaying the characters that you type. At the command line, theoperating system normally echoes all your input. Emacs handles echoing differently.

    Single-character commands do not echo in Emacs, and multi-character commands echoonly if you pause while typing them. As soon as you pause for more than a second inthe middle of a command, Emacs echoes all the characters of the command so far. Thisis to prompt you for the rest of the command. Once echoing has started, the rest of thecommand echoes immediately as you type it. This behavior is designed to give confidentusers fast response, while giving hesitant users maximum feedback. You can change thisbehavior by setting a variable (see Section 11.17 [Display Custom], page 78).

    If a command cannot do its job, it may display an error message in the echo area. Errormessages are accompanied by beeping or by flashing the screen. The error also discards anyinput you have typed ahead.

    Some commands display informative messages in the echo area. These messages lookmuch like error messages, but they are not announced with a beep and do not throw awayinput. Sometimes the message tells you what the command has done, when this is notobvious from looking at the text being edited. Sometimes the sole purpose of a commandis to show you a message giving you specific informationfor example, C-x = (hold downCTRL and type x, then let go of CTRL and type =) displays a message describing thecharacter position of point in the text and its current column in the window. Commandsthat take a long time often display messages ending in ... while they are working, and adddone at the end when they are finished. They may also indicate progress with percentages.

  • Chapter 1: The Organization of the Screen 8

    Echo-area informative messages are saved in an editor buffer named *Messages*. (Wehave not explained buffers yet; see Chapter 16 [Buffers], page 145, for more informationabout them.) If you miss a message that appears briefly on the screen, you can switch tothe *Messages* buffer to see it again. (Successive progress messages are often collapsedinto one in that buffer.)

    The size of *Messages* is limited to a certain number of lines. The variable message-log-max specifies how many lines. Once the buffer has that many lines, adding lines at theend deletes lines from the beginning, to keep the size constant. See Section 32.3 [Variables],page 387, for how to set variables such as message-log-max.

    The echo area is also used to display the minibuffer, a window where you can inputarguments to commands, such as the name of a file to be edited. When the minibuffer isin use, the echo area begins with a prompt string that usually ends with a colon; also, thecursor appears in that line because it is the selected window. You can always get out of theminibuffer by typing C-g. See Chapter 5 [Minibuffer], page 28.

    1.3 The Mode Line

    Each text windows last line is a mode line, which describes what is going on in that window.The mode line starts and ends with dashes