Trailing-Edge - PDP-10 Archives - mit_emacs_170_teco_1220 - info/emacs.docond
There are no other files named emacs.docond in the archive.
This is the DOCOND source from which the INFO file for EMACS and
the EMACS GUIDE are generated.  Be sure to read the comments among the
DOCOND declarations very carefully, because they tell how to format
the input so that both the INFO and GUIDE versions will come out right.

Set up GUIDE to be LPT or XGP.

{Flag:+TRUTH}   Always true, for unconditional replacements.

{Char Replace:+XGP=>->R}
{Char Replace:+XGP=>->^}
{Char Replace:+XGP=>->S}


Note that the characters  followed by 
 cause themselves and the
following line to be conditionalized for the INFO version only.
It should be the INFO node header.  The line will simply be deleted in the GUIDE
version, so no conditionals should begin or end within it unless
completely contained within it.

The best way to put an INFO footnote at the end of a paragraph is: {+INFO:
*Note footnote: node, here is the footnote.}

"Chapter:", "Section:" or "Subsection:" at the front of the line
is a no-op in the INFO version, but in the GUIDE version it puts
@CHAPTER(...), etc., around the rest of the line.

{Char Replace:+INFO=>Chapter:->}
{Char Replace:+GUIDE=>Chapter:-->>0L I@ S: -DI[ :L I]}
{Char Replace:+INFO=>Subsection:->}    Must precede Section!
{Char Replace:+GUIDE=>Subsection:-->>0L I@ S: -DI[ :L I]}
{Char Replace:+INFO=>Section:->}
{Char Replace:+GUIDE=>Section:-->>0L I@ S: -DI[ :L I]}
{Char Replace:+INFO=>
{Char Replace:+GUIDE=>
Paragraph:-->>0L I@ S: -DI[ :L I]}
{Char Replace:+GUIDE=>
-->>2R 2K}

SCRIBE requires two @'s whenever one is wanted.  That's the way it
should be in this file.  For the INFO version, we collapse them.
The SCRIBE "@:" construct must be used when a sentence ends with a
one-letter word.  "@." must be used when a sentence end appears to
occur after an abbreviation.

{Char Replace:+INFO=>@@->@}
{Char Replace:+INFO=>@:->.}
{Char Replace:+INFO=>@.->.}

An indented list of commands should be surrounded by lines
saying simply 

These Textunit lines are not significant in that they do not
contribute CRLFs to the output (at least in the INFO version).
The lines in between will have all leading whitespace deleted to
produce the SCRIBE input.  The first tab within a line (not at the
front) will turn into a @\ command, and that line will get a blank
line in front of it.
You can control the indentations used by choosing @Commands,
or @WideCommands, @DoubleWideCommands, or @GrossCommands
Other things like @Example and @Quotation are also reasonable.

{Char Replace:+INFO=>Textunit:-->> 0LK}

{Char Replace:+GUIDE=>Textunit:@-->>
  R0K L .[0 
  STextunit: 0K
  < .-Z;
    @F 	K
 I :FB	"L -D  @F	 K I@\  0L I
    L >
  Q0J }

The SCRIBE constructs @U and @I cannot be used.  Instead, use @XXU and
@XXI for underlining and italicizing.  The name change is to make it
easier to find them to delete them from the INFO version.
Alternatively, use @XXUU and @XXII, which will turn into all caps in
the INFO version.

{Char Replace:+INFO=>@XX-->>
  -3D .[0 S[ Q0,.K
  S] -D
  Q1"N Q0,.@FC' }

To put things in the index, do

{Char Replace:+INFO=>Indexentry:-->> 0lk}
{Char Replace:-INFO=>Indexentry:-->>
  < :@f"e 0;'
    i@index 123i

    fkc 125i
    1a-,"e d'
{+INFO:This file documents the EMACS editor.  -*-Text-*-
Don't edit this file! It is produced by DOCOND from the EMACSD file.
Be sure to run TAGS over this file after you DOCOND it.

EMACS  Node: Top,  Up: (DIR)

The EMACS Editor

* Menu:

* Intro::	An introduction to this documentation.
* Characters::	EMACS's character sets;  usage from deficient
		(ie, standard ASCII or upper case only) keyboards.
* Screen::	How to interpret what you see on the screen.
* Basic::	The most basic editing commands.
* Arguments::	Giving numeric arguments to commands.
* Mark::	The Mark: how to delimit a "region" of text.
* Killing::	Killing text.
* Un-killing::	Recovering killed text.  Moving text.
* Copying::	Other ways of copying text.
* M-X::		Issuing long-named "extended" commands.
* Help::	Commands for asking EMACS about its commands.
* Unwedging::	What to do if EMACS is hung.
* Undo::	Undoing a command which destroyed your text.
* Bugs::	How and when to report a bug.
* MajorModes::	Text mode vs. LISP mode vs. MIDAS mode ...
* MinorModes::	Some other useful options you can turn on and off.
* Variables::	Named variables:  what they do and how to use them.
* Init::	Init files and how to customize your EMACS.
* Libraries::	Loading additional libraries of commands (subsystems).
* Display::	Controlling what text is displayed.
* Windows::	Viewing two pieces of text at once.
* Files::	All about handling files.
* Search::	Finding or replacing occurrences of a string.
* Fixit::	Commands especially useful for fixing typos.
* Programs::	Commands and modes for editing programs.
* Text::	Commands and modes for editing English.
* Paging::	Commands for dealing with pages in files.
* Narrowing::	Commands for narrowing view to part of the buffer.
* Minibuffer::	How to escape to TECO.
* KBDMAC::	Subsystem for abbreviating a sequence of commands.
* PICTUR::	Subsystem for editing pictures made out of characters.
* Sort::	Commands for sorting part of the buffer.
{+Twenex:* Misc::	A few random functions
}* Abbrev: (WORDAB)	How to define text abbreviations to reduce
			the number of characters you must type.
* SLOWLY: (SLOWLY)	A package of macros for people using slow
* DOCOND: (DOCOND)	Subsystem for "assembly conditionals"
			in documentation files.
* Tags: (TAGS)	The Tags subsystem remembers the location of each
		"tag" or function definition in one or more files,
		and allows you to go directly to any of them.
{+ITS:* RMAIL:(RMAIL)	Subsystem for editing mail.
}* Babyl: (Babyl){+ITS:	Babyl is, like RMail, an EMACS mail subsystem.
			It differs from RMail in some respects, in
			particular: it will run on TENEX and TWENEX.
}{+Twenex:	For reading mail.
}* INFO: (INFO)	Subsystem for reading documentation files.
* PL1: (EPL1)	Subsystem containing PL1 Mode, a major mode.
* PASCAL: (EPASC)	Subsystem containing PASCAL Mode, a major mode.
* TDEBUG: (TDEBUG)	EMACS macro 2 window real-time debugger.
* Internals: (EMACS;CONV)
	EMACS internals.  Customization.  Init files.
	The TMACS library contains an assortment of EMACS commands and

Here are some other nodes which are really inferiors of the ones
already listed, just so you can get to them in one step:

* ModeLine::	How to interpret the Mode line at top level.
* ModeLine1::	The Mode line inside subsystems and commands.
* MMArcana::	Hows and whys of MM commands.
* Syntax::	The syntax table.
* Visiting::	How to visit a file for editing.
* Revert::	How to cancel some changes you have made.
* Buffers::	How to keep several files in core at once.
* Locals::	How to make a file say what mode
		it should be edited with.
* AutoSave::	Protection from system crashes.
* CleanDir::	Deleting piled up old versions of files.
* DIRED::	Deleting files by "editing your directory".
* Filadv::	Miscellaneous file commands.
{+ITS:* DirComp::	Comparing two directories.
}* Replace::	Replace one string by another, etc.
* Indenting::	Indentation commands for programs.
* Matching::	Automatic display of how parens balance.
* Lists::	Commands for moving over lists.
* Comments::	Commands which understand comments in code.
* Grinding::	Reformatting LISP code.
* MIDAS::	Commands for assembler language code.
* Words::	Commands for moving over words.
* Sentences::	Commands for sentences and paragraphs.
* TextIndent::	Commands for indenting text.
* Filling::	Commands for filling and centering text.
* Case::	Case conversion commands.
* NoLowerCase::	What to do on terminals with no lower case.
{+ITS:* Fonts::	Font change commands.
* Underlining::	Underlining commands.
}* PAGE::	Macros for editing only one page at a time.
* Printing::	Printing terminals.

@Define(Commands=Description,LeftMargin 16,Indent -8,Spread 0)
@Define(WideCommands=Description,LeftMargin 20,Indent -12,Spread 0)
@Define(DoubleWideCommands=Description,LeftMargin 24,Indent -16,Spread 0)
@Define(GrossCommands=Description,LeftMargin 16,Indent -16,Spread 1)

@MajorHeading(EMACS Manual for {+ITS:ITS}{+Twenex:Twenex} Users)
This manual corresponds to EMACS version 142
This report describes work done at the Artificial Intelligence Laboratory
of the Massachusetts Institute of Technology.  Support for the laboratory's
research is provided in part by the Advanced Research Projects Agency of the
Department of Defense under Office of Naval Research contract N00014-75-C-0643.
  This manual documents the use and simple customization of the
extensible display editor EMACS with the {+ITS:ITS}{+Twenex:Twenex
(officially known as "Tops-20")} operating system.  It is addressed to
the nearly-new user who has a little experience in the most basic use
of EMACS, learned by means of the on-line learn-by-doing tutorial, the
{+Twenex:TEACH-EMACS}{+Its:TEACHEMACS} program.  If you enjoy thinking
abstractly you can learn everything from this manual, but we recommend
that you first use the {+Twenex:TEACH-EMACS}{+Its:TEACHEMACS} program
to get a feel for the EMACS world view more vivid than anything read
in a manual.  All the information in the manual is available on-line
for reference in the INFO documentation system.

  For a copy of EMACS for use on Twenex systems, you should write to
me, Richard M. Stallman, at

	MIT Artificial Intelligence Lab
	545 Tech Square, rm 913
	Cambridge, MA 02139

  For more information on the philosophy of EMACS and the lessons
learned from its development, you should write to me to ask for a copy
of the paper, "EMACS, the Extensible, Customizable Self-Documenting
Display Editor", which addresses these questions.

						 /  2 \ 1/2
						<  X   >
						 \    /
EMACS  Node: Intro, Up: Top, Previous: Top, Next: Characters


  You are now about to read about EMACS, an advanced, extensible,
self-documenting real-time display editor.

  We say that EMACS is a display editor because normally the text
being edited is visible on the screen and is updated automatically as
the user types his commands.  No special "print" command is necessary.

  We call it a "real-time" editor because the user's input is made up
mostly of very short units, so display updating happens frequently.
For example, if there were an "insert" command, the display would not
be updated until the end of a long insertion.  Instead, EMACS
considers each inserted character a separate command, so the display
is updated with maximum frequency.  This reduces the amount of
information the user must keep in his head as he edits.

  What makes EMACS extensible is that each command character can be
redefined to run an arbitrary program written in the language TECO.
Also, EMACS is an "online extensible" system, which means that it
divided into many functions which call each other, and the function
name information is not discarded as it would be in most compiled
languages.  This way, one function can be redefined at run time, and
all functions that use it will automatically use the new definition.
This allows the user to replace a part of the system without having to
make a copy of the whole thing.  It is not necessary to write any
extensions in order to edit, however.  This manual will not attempt to
document TECO, though it will refer at times to connections between
specific EMACS features and the specific TECO implementation
techniques used by them.  Such remarks can be ignored by those who
don't know TECO.  For advice on learning TECO, see the INFO file
called CONV.{+INFO:  *Note TECO: (EMACS;CONV).}

  EMACS is self-documenting because it provides a character which can
be used at any time to ask for information on what sort of input is
expected, and what options or commands are available.

  We call EMACS advanced because it provides facilities not just for
simple things like inserting and deleting text, but for automatic
indentation of programs; viewing two files at once; dealing in terms
of words, paragraphs, sentences, expressions and comments; keeping
track of which parts of a program reside in which source file; and

EMACS  Node: Characters, Up: Top, Previous: Intro, Next: Screen

Chapter:Character Sets and Command Input Conventions

  Here we describe the character set to which EMACS commands logically
belong.  In other words, we describe the virtual keyboard which EMACS
likes to think it has.  Then we go on to describe the way various
actual keyboards are mapped into the virtual one.  This chapter is
essential for understanding the definitions of commands later on, but
would seem unmotivated now.  So you can skip it and come back when you
see terms like "Control" and "Meta" and want an explanation.

Section:The 9-bit Command Character Set

Indexentry:control,meta,Altmode,Rubout,Space character,<cr>,Return,character set
  EMACS uses a special 512-character "9-bit" character set for its
keyboard commands.  Some keyboards can generate the whole 9-bit
character set themselves.  Ordinary ASCII keyboards cannot, so
two-character sequences are used to represent the characters which
have no equivalents in ASCII.  The 9-bit character set applies only to
keyboard input.  Characters in files edited with EMACS are ASCII

  The 9-bit character set starts with the 7-bit ASCII character set
and adds two modifier bits called "Control" and "Meta", sometimes
abbreviated "C" and "M".  Thus, the character which is made up of the
ASCII character "A" and the Control and Meta bits is called
"Control-Meta-A" or "C-M-A".  "C-Space" is the ASCII character space
plus the control bit.  "C-M-Return" is the carriage return character
with the two modifier bits.  In ASCII it makes no sense to talk of
Control-Return because Return is already a control character, but in
the 9-bit character set where Control is a separate bit Control-Return
makes sense.  Since Control is represented by a bit of its own, there
is no need for codes such as 001 to serve as Control-A.  So all codes
from 000 to 037 which are not formatting characters become new
printing characters called the SAIL characters.  However, these are
only available on special keyboards and don't affect editing much.

section:Prefix Characters

Indexentry:C-X,prefix characters
    On ASCII keyboards, in order to type any Meta characters, and many
Control characters such as C-Space, C-;, and C-=, it is necessary to
use two character sequences which start with a "bit prefix" character
which turns on the Control or Meta bit in the second character.  The
Altmode character turns on the Meta bit, so Altmode X can be used to
type a Meta-X, and Altmode Control-O can be used to type a C-M-O.
Altmode is known as "the Metizer".  There is also a bit prefix
character for Control and one for both Control and Meta.  Note: the
character C-X is also a "prefix" character which is the start of many
two-character sequences.  However, they are not abbreviations for any
single characters, and must be typed as two characters on all

  Most of the EMACS commands documented herein are members of this
9-bit character set.  Others are pairs of characters from that set.
However, EMACS contains another kind of entity that we will also be
documenting: this is the "function".  A function is an object which
has a long name, such as "^R Down Real Line", and has a specific
behavior, which can be documented, such as moving down a line.
Commands and functions are related, because each command does its job
by calling some function.  What purports to be documentation for a
command is really the documentation for the function which the command
normally calls.  If you customize EMACS, the same function could be
attached to any other command and still do the same thing; the command
could be connected to some other function and would behave completely
differently.  When a command is documented, the name of the function
which it calls, and which is what is @xxi[really] being documented, will be
given in parentheses, as in "C-N (^R Down Real Line)".

section:Notational Conventions for ASCII Characters

  Control characters in files, your EMACS buffer, or TECO programs,
are ordinary ASCII characters and are represented as uparrow or caret
followed by the corresponding non-control character: control-E is
represented as ^E.  The special 9-bit character set applies only to
keyboard input, and not always for that, since sometimes only the
ASCII equivalent of a character you type is important.

  "Return" or "<cr>" stands for the ASCII carriage return character,
code 015.  "Rubout" is the ASCII code 177, sometimes labeled "Delete".
Other ASCII characters with special names are Tab (Control-I, 011),
Backspace (Control-H, 010), Linefeed (Control-J, 012) and Space (040).
Altmode is the ASCII code 033 sometimes labeled "Escape" or
"Alt".  Altmode is often represented by itself in this document
(remember, it is an ASCII character and can therefore appear in
files).  It looks like this: .  {+INFO:This is also how it will
appear on your screen if you insert it in your file.} On some
terminals, Altmode looks just like the dollar sign character.  If
that's so on yours, you should assume that anything you see in this
document which looks like a dollar sign is really an Altmode unless
you are specifically told it's a dollar sign.  The dollar sign
character is not particularly important in EMACS and we will rarely
have reason to mention it.{*Refill:}

  Now you should turn to the node that describes the keyboard you are

* Menu:
* MetaKey::	for keyboards that have a "Meta" key.
* EditKey::	for keyboards that have an "Edit" key.
* Losers::	for keyboards that have neither "Meta" nor "Edit."

  There are special commands designed to make life tolerable on
terminals which cannot send or display lower case.
* NoLowerCase::	for how to use them.

  You can even use EMACS on a printing terminal or glass teletype.
* Printing::	for how.
@section(Particular Types of Terminals)
EMACS  Node: MetaKey, Up: Characters, Previous: Characters

Subsection:Keyboards that have a "Meta" key
Indexentry:meta,SAIL characters
{+Guide:{+ITS:@INDEX[Escape key]}
  On a keyboard with a Meta key, to type any character in the 9-bit
character set just hold down Control or Meta as appropriate while
typing the key for the rest of the character.  To type C-M-K, type K
while holding down Control and Meta.
  You will notice that there is a key labeled "Escape" and a key
labeled "Alt".  The Altmode character is the one labeled "Alt".
"Escape" has other functions entirely;  it is handled by the system
and has nothing to do with EMACS.

  The key labeled "Top" is an extra shift key.  It is used to produce
the peculiar "SAIL" graphics characters which appear on the same keys
as the letters.  The "Shift" key gets you upper-case letters, but
"Top" gets you the SAIL characters.  As EMACS commands, these
characters are normally self-inserting, like all printing characters.
But once inserted, SAIL characters are really the same as ASCII
control characters, and since characters in files are just 7 bits
there is no way to tell them apart.  EMACS can display them either as
ASCII control characters, using an uparrow or caret to indicate them,
or it can display them as SAIL characters, whichever you like.  The
character Control-Alpha (where Alpha is a SAIL character) toggles the
choice.  You can only type this command on a terminal with a Top key,
but since only such terminals can display SAIL characters anyway this
is no loss.

}  The "bit prefix" characters that you must use on other terminals are
also available on terminals with Meta keys, in case you find them more
convenient or get into habits on those other terminals.{+INFO:
* Note Bit Prefix: Losers.}

paragraph:Numeric Arguments

  To type numeric arguments on these keyboards, just type the digits
or minus sign while holding down either Control or Meta.

EMACS  Node: EditKey, Up: Characters, Previous: Characters

Subsection:Keyboards with an "Edit" key
Indexentry:Edit key,meta

  Keyboards with Edit keys probably belong to Datamedia or Teleray
terminals.  The Edit and Control keys are a pair of shift keys.  You
use the Control key to type control characters and the Edit key to
type Meta characters.  Thus, the 9-bit EMACS character C-M-Q would be
typed by striking the "Q" key while holding down "Edit" and "Control".

  While the Edit key is a true independent bit which can be combined
with anything else you can type, the Control key really means "ASCII
control".  Thus, the only Control characters you can type are those
which exist in ASCII.  This includes C-A{+Twenex:, C-B, C-D}
through C-{+ITS:Y}{+Twenex:Z}, C-], C-@@, C-\,
and C-^.  C-Z{+ITS: and C-_} can be typed on the terminal but
{+ITS:they are}{+Twenex:it is} intercepted by the operating system
and not seen by EMACS, so for practical purposes you can't
type {+ITS:them}{+Twenex:it}.{*Refill:}

  The control characters that are not part of ASCII are not essential
commands.  But you also can't type the corresponding control-meta
characters.  There is no way to type C-M-; since the C-; itself can't
be typed.  Edit-Control-; will give you some random result.  To type
them, you can use the C-C bit prefix character, followed by the
character you want, sans "control" and "meta".  For example, C-C
followed by a ";" will give you C-M-;.

Paragraph:Numeric Arguments

Indexentry:numeric arguments
  To type numeric arguments, it is best to type the digits or "-"
while holding down the Edit key.

EMACS  Node: Losers,  Up: Characters,  Previous: Characters

Subsection:ASCII Keyboards
Indexentry:Meta,Edit key,bit prefix characters,metizer

  An ASCII keyboard allows you to type in one keystroke only the
command characters with equivalents in ASCII.  A character not containing Control or Meta can be typed directly.
So can some characters containing Control; specifically, those which
correspond to ASCII nonformatting
controls: C-A{+Twenex:, C-B, C-D} through {+ITS:C-Y}{+Twenex:C-Z}, and
C-], C-\, {+Twenex:C-_, }C-@@, and
C-^ (the terminal can generate {+ITS:C-Z and C-_}{+Twenex: control-C}, but
{+ITS:they are}{+Twenex:it is} pre-empted for other uses by
the operating system and do{+Twenex:es} not reach EMACS).
You can't type C-[, because in ASCII Control-[ is really

  Most of the other characters can be generated by means of the "bit
prefix" characters Altmode and C-C.  Altmode turns on the Meta bit of
the character that follows it.  Thus, M-A can be typed as Altmode A,
and C-M-A as Altmode C-A.  Altmode can be used to get almost all of
the characters that can't be typed directly.  C-C can be used to type
any Control-Meta character, including a few that Altmode can't be used
for because the corresponding non-Meta character isn't on the
keyboard.  Thus, while you can't type C-M-; as Altmode Control-;,
since there is no Control-; in ASCII, you can type C-M-;
as C-C ;.  The remaining characters, which are those that have Control but not
Meta with a basic character other than
A{+Twenex:, B, D} - {+ITS:Y}{+Twenex:Z}, ], \, @@ and ^, cannot be
typed conveniently on ASCII keyboards.  The only way to type them is
to use the "controlizer" prefix character C-^, but this character is a
nuisance to type.  Because of this, the EMACS command set is arranged
so that most of these non-ASCII control characters are not very
important, because they have synonyms which are easier to type.  In fact, in this
manual only the easier-to-type forms will usually be mentioned.{*Refill:}

  There are a few times when the Altmode character is given some special
meaning temporarily.  At such times, to type a Meta character, you must
use C-\, which is also a Meta prefix character.

  The C-\ and C-C bit prefix characters ignore the presence of
Control in the following character.  That is, C-C C-X gives C-M-X,
just as C-C X does.  This is useful because C-C C-X is easier to type
fast than C-C X.  Because of this, you cannot make Control-Meta
characters with C-\ the way you can with Altmode;  you must use C-C.

Indexentry:C-X,prefix characters
  The bit-prefix characters C-\, C-C and Altmode should not be
confused with the prefix character C-X.  Bit-prefix characters allow
you to type characters that are not on your keyboard.  They work by
reading in your next character, adding on the appropriate meta bits,
and executing that character as if you had been able to type it in one
keystroke.  An ordinary prefix character, such as C-X, is the
beginning of a two-character command.  There is no keyboard on which
you can type a C-X command as less than two characters.

Paragraph:Numeric Arguments
Indexentry:numeric arguments,autoarg mode,init file

  On ASCII keyboards, you can type a numeric argument by typing an
Altmode followed by the minus sign and/or digits.  Then should come
the command for which the argument is intended.  If it is a Meta
command, it must have an Altmode of its own.  The way this works is,
the first Altmode and digit combine to form a Meta-digit character,
which is defined to accumulate digits into an argument and feed it to
the first non-digit character which is seen.  This is not the normal
definition of Meta-digits.  The default EMACS init file redefines them
when it sees that you have an ASCII keyboard.

  If you use numeric arguments very often, and even typing the Altmode
is painful, you might want to turn on Autoarg Mode, in which you can
specify a numeric argument by just typing the digits.{+INFO:
*Note Autoarg: Arguments, for details.}

EMACS  Node: NoLowerCase, Up: Characters

Subsection:Upper-case-only Terminals
Indexentry:case conversion

  On terminals lacking the ability to display or enter lower case
characters, a special input and output case-flagging convention has
been defined for editing files which contain lower case characters.

  The customary escape convention is that a slash prefixes any upper
case letter;  all unprefixed letters are lower case (see below for the
"lower case punctuation characters").  This convention is chosen
because lower case is usually more frequent in files containing any
lower case at all.  Upper case letters are displayed with a slash
("/") in front.  Typing a slash followed by a letter is a good way to
insert an upper case letter.  Typing a letter without a slash will
insert a lower case letter.  For the most part, the buffer will appear
as if the slashes had simply been inserted (type /A and it will insert
an upper case A, which will display as /A), but cursor-motion commands
will reveal that the slash and the A are really just one character.
Another way to insert an upper-case letter is to quote it with C-Q.

  Note that this escape convention applies only to display of the
buffer and insertion in the buffer.  It does not apply to arguments
of commands (it is hardly ever useful for them, since case is
ignored in command names and most commands' arguments).  Case
conversion is performed when you type commands into the minibuffer,
but not when the commands are actually executed.

  The ASCII character set includes several punctuation characters
whose codes fall in the lower case range and which cannot be typed or
displayed on terminals that cannot handle lower case letters.  These
are the curly braces, the vertical bar, the tilde, and the accent
grave.  Their upper case equivalents are, respectively, the square
brackets, the backslash ("\"), the caret ("^"), and the atsign ("@@").
For these punctuation characters, EMACS uses the opposite convention
of that used for letters:  the ordinary, upper case punctuations
display as and are entered as themselves, while the lower case forms
are prefixed by slashes.  This was found to be less confusing than
carrying over the convention used for letters (as was originally
done).  So, for example, to insert an accent grave, type "/@@".

  When the slash escape convention is in effect, a slash is displayed
and entered as two slashes.

  This slash-escape convention is not normally in effect.  To turn it
on, the TECO command "-1$" (minus one dollarsign, not Altmode!) must
be executed.  The easiest way to do this is to use the minibuffer:
Altmode Altmode -1$ Altmode Altmode.  To turn off the escape
convention (for editing a file of all upper case), the command is 0$
(zero dollarsign), or Altmode Altmode 0$ Altmode Altmode.  If you use
such a bad terminal frequently, you could define yourself a character
to turn slash-escape on and off.

  The lower case editing feature is actually more flexible than
described here.  Refer to the TECO commands F$ (F Dollarsign) and
FS CASE, using M-X TECDOC, for full details.

{+INFO:* Note Case: Case, for commands to change the case of text already in
the buffer.
EMACS  Node: Printing, Up: Characters

Section:Use of EMACS from Printing Terminals
Indexentry:printing terminal

  While EMACS was designed to be used from a display, you can
effectively use it from a printing terminal.  You cannot, however,
learn EMACS using one.

  All EMACS commands have the same effect on a printing terminal as
they do on a display.  All that is different is how they try to show
what they have done.  EMACS attempts to make the same commands that
you would use on a display terminal act like an interactive
line-editor.  It does not do as good a job as editors designed
originally for that purpose, but it succeeds well enough to keep you
informed of what your commands are accomplishing, provided you know
what they are supposed to do and know how they would look on a

  The usual buffer display convention for EMACS on a printing terminal
is that the part of the current line before the cursor is printed out,
with the cursor following (at the right position in the line).  What
follows the cursor on the line is not immediately visible, but
normally you will have a printout of the original contents of the line
a little ways back up the paper.  For example, if the current line
contains the word "FOOBAR", and the cursor is after the "FOO", just
"FOO" would appear on the paper, with the cursor following it.  Typing
the C-F command to move over the "B" would cause "B" to be printed, so
that you would now see "FOOB" with the cursor following it.  And so
on.  All forward-motion commands that move reasonably short distances
echo what they move over.

  Backward motion is handled in a complicated way.  As you move back,
the terminal backspaces to the correct place.  When you stop moving
back and do something else, a linefeed is printed first thing so that
the printing done to reflect subsequent commands does not overwrite
the text you moved back over and become garbled by it.  The Rubout
command acts like a sort of backward motion, but also prints a slash
over the character rubbed out.  Other backwards deletion commands also
act like backward motion but are not hairy enough to print the
slashes;  it is up to you to remember that you did deletion and not

  One command is different on a printing terminal:  C-L, which
normally means "clear the screen and redisplay".  With no argument, it
will retype the entire current line.  An argument tells it to retype
the specified number of lines around the current line.

  Unfortunately, EMACS cannot perfectly attain its goal of making the
text printed on the current line reflect the current line in the
buffer, and keeping the horizontal position of the cursor correct.
One reason is that it is necessary for complicated commands to echo,
but echoing them screws up the "display".  The only solution is to
type a C-L whenever you have trouble following things in your mind.
The need to keep a mental model of the text being edited is, of
course, the fundamental defect of all printing terminal editors.

  Note:  it is possible to make a specific command print on a printing
terminal in whatever way is desired, if that is worth while.  For
example, Linefeed knows explicitly how to display itself, since the
general TECO redisplay mechanism isn't able to handle it.  Suggestions
for how individual commands can display themselves are welcome, as
long as they are algorithmic rather than simply of the form "please do
the right thing".

EMACS  Node: Screen, Up: Top, Previous: Characters, Next: Basic

Chapter:The Organization of the Screen

  EMACS divides the screen into several areas, which contain different
sorts of information.  The biggest area, of course, is the one in
which you usually see the text you are editing.  The terminal's
blinker usually appears in the middle of the text, showing the
position of "point", the location at which requested changes will be
made.  While the cursor appears to point @xxii[at] a character, point should
be thought of as @xxii[between] two characters;  it points @xxii[before] the
character that the blinker appears on top of.  Terminals have only one
blinker, and when type out is in progress it must appear where the
typing is being done.  At those times, unfortunately, there is no way
to tell where point is except by memory or dead reckoning.

indexentry:error message
  The top lines of the screen are usually available for text but are
sometimes pre-empted by an "error message", which says that some
command you gave was illegal or used improperly, or by printed output
produced by a command (such as, the description of a command printed
by Help C)@.  The error message or printed output appears there for
your information, but it is not part of the file you are editing, and
it will go away if you type any command.  If you want to make it go
away immediately but not do anything else, you can type a Space.
Usually a Space inserts itself, but when there is an error message or
printed output on the screen it does nothing but get rid of them.

indexentry:echo area,prompting
  A few lines at the bottom of the screen compose what is called "the
echo area".  {+INFO:It is the place where INFO types out the commands that
you give it.}  EMACS does not normally echo the commands it is given,
but if you pause for more than a second in the middle of a
multi-character command then the whole command (including what you
have typed so far) will be echoed.  This behavior is designed to give
confident users optimum response, while giving nervous users
information on what they are doing.

  EMACS also uses the echo area for reading and displaying the
arguments for some commands, such as searches, and for printing
information in response to certain commands such as C-X =.

  The line above the echo area is known as the "more line" or the
"mode line".  It is the line that usually starts with "EMACS (something)".
Its purpose is to tell the user at all times what is going on in the
EMACS - primarily, to state any reasons why commands will not be
interpreted in the standard way.  The mode line is very important, and
if you are surprised by how EMACS reacts to your commands you should
look there for enlightenment.

{+INFO:* Menu:			These subnodes are important reading.

* Top Level: Modeline	What the mode line usually tells you.
* Down:	Modeline1	What the mode line tells you when you are
			inside a command.
EMACS  Node: ModeLine, Previous: Screen, Up: Screen, Next: ModeLine1

Section:The Mode Line
Indexentry:mode line,more line

{+Info:  The line above the echo area is known as the "More line" or the
"Mode line".  It is the line that usually starts with "EMACS (something)".
Its purpose is to tell the user at all times what is going on in the
EMACS - primarily, to state any reasons why commands will not be
interpreted in the standard way.  The Mode line is very important, and
if you are surprised by how EMACS reacts to your commands you should
look there for enlightenment.

}  The normal situation is that characters you type will be interpreted
as EMACS commands.  When this is so, you are at "top level", and the
Mode line will look like this:

        EMACS{+ITS: type}  (major minor)  bfr:  file --pos--
Indexentry:Editor Type,LEDIT,MAILT,RMAIL
  "type" will usually not be there.  When it is there, it indicates
that the EMACS job you are using is not an ordinary one, in that it is
acting as the servant of some other job.  A type of "LEDIT" indicates
an EMACS serving one or more LISPs, while a type of "MAILT" indicates
an EMACS which you got by asking for an "edit escape" while composing
mail to send.  The type can also indicate a subsystem which is
running, such as RMAIL.  The variable Editor Type holds the type.
Indexentry:major modes,submode
  "major" will always be the name of the "major mode" you are in.
At any time, EMACS is in one and only one of its possible major modes.
The major modes available include Text Mode, Fundamental Mode (which
EMACS starts out in), LISP Mode, and others.  {+INFO:*Note Major: MajorModes
for details of how the modes differ and how to select one.  }Sometimes
the name of the major mode will be followed immediately with another
name inside square-brackets ("[ - ]").  This name is called the
"submode".  The submode indicates that you are "inside" of a command
which causes your editing commands to be changed temporarily, but does
not change @xxii[what] text you are editing.  You can get out of any
submode with C-C C-C.{*Refill:}

Indexentry:minor modes,auto fill mode,auto save mode,atom word mode
  "minor" is a list of some of the minor modes which are turned on at
the moment.  "Fill" means that Auto Fill mode is on.  "Save" means
that Auto-saving is on.  "Save(off)" means that Auto-saving is on in
general but momentarily turned off (it was overridden the last time a
file was selected).  "Atom" means that Atom Word mode is on.{+INFO:
*Note Minor: MinorModes, for how to turn them on and off.}

  "bfr" is the name of the currently selected buffer.  A buffer is an
object in EMACS which can hold a file being edited.  There can be many
buffers in one EMACS, each with its own name and holding its own file,
but at any time you are editing only one of them, the "selected"
buffer.  When we speak of what some command does to "the
buffer", we are talking about the currently selected buffer.
Multiple buffers makes it easy to switch around between several files,
and then it is very useful that the mode line tells you which one you
are editing at any time.  However, before you learn how to use
multiple buffers, you will always be in the buffer called "Main",
which is the only one which exists when EMACS starts up.  If the name
of the buffer is the same as the first name of the file you are
visiting, then the buffer name will be left out of the mode line.{+INFO:
*Note Buffer: Buffers, for how to use more than one buffer in one EMACS.}

  "file" is the name of the file that you are editing.  It is the last
file that was visited in the buffer you are in.  If "(RO)" (for "read
only") appears after the filename, it means that if you visit another
file then changes you have made to this file will be lost unless you
have explicitly asked to save them.{+INFO:  *Note Visiting: Visiting.}

  "pos" tells you whether there is additional text above the top of
the screen, or below the bottom.  If your file is small and it is all
on the screen, --pos-- is omitted.  Otherwise, it is --TOP--, --BOT--,
or --nn%-- where nn is the percentage of the file above the top of the

  Sometimes you will see --MORE-- instead of --nn%--.  This happens
when some printed output is too long to fit on the screen.  It means
that if you type a space the next screenful of information will be
printed.  Typing anything but a Space will cause the rest of the
output to be discarded - in case you aren't interested.  Typing a
Rubout will discard the output and do nothing else.  Typing any other
command will discard the rest of the output and also do the command.
When the output is discarded, "FLUSHED" will be printed after the

  Other editors will usually display, in their status line, things
like the current page number and line number in the file.  The way
EMACS stores its text, there is no way to know those particular
quantities without a lot of work.  There are some things which
EMACS can tell you, but they are deemed not interesting enough to be
worth updating, so you have to ask to see them.

Section:Where is the Cursor in the File?  In the Screen?

Indexentry:C-X =,echo area
  The command C-X = (^R Where Am I) can be used to find out the column
that the cursor is in.  It will print a line in the echo area that
looks like this:

	X=5 Y=7 CH=101 .=3874(35% of 11014) H=<3051,4640>

  In this line, the X value is the column the cursor is in (zero at
the left), the Y value is the screen line that the cursor is in (zero
at the top), the CH value is the octal value of the character after
the cursor, the point value is the character number of the cursor, and
the values in parentheses are the percentage of the buffer before the
cursor and the total size of the buffer.

  The H values are the virtual buffer boundaries, indicate which part of
the buffer is still visible when narrowing has been done.  If you have
not done narrowing, the H value would be omitted.{+INFO:
For more information on narrowing, *Note Narrowing: Narrowing.}

{+INFO:  So much for what the Mode line says at top level.  When the mode
line doesn't start with "EMACS", and doesn't look anything like the
breakdown given above, then EMACS is not at top level, and your typing
will not be understood in the usual way.  This is because you are in
the middle of a special purpose command -- such as INFO, for example.
When this happens, the mode line is still useful.  Move on to the Next

EMACS  Node: Modeline1,  Previous: Modeline, Up: Screen

Section:Recursive Editing Levels

  When the mode line does not start out saying "EMACS", it means you
are "inside" of a subsystem, typing commands for the subsystem, or you
may be inside a "recursive editing level".  This means that you are
inside a command which has given you some text for you to edit.  The
text may or may not be part of the file you are editing.  {+INFO:For
example, right now you are inside the subsystem INFO, and as you can
see the mode line tells you so.}  For example, you might be inside Edit
Options editing the values of the EMACS options.  The mode line tells
you what is going on, and also gives you an idea of how to "get out"
if you don't like it.{+INFO: *Note Unwedging: Unwedging, for
information on that, but you should finish this node first.}

Indexentry:recursive editing level,C-M-C,C-]
  When the Mode line says something like "[command name - ^R]", it
means that the command whose name appears there has put you in a
recursive editing level to edit some text.  It may be a message to be
sent, or tab settings to change, or anything else.  In some commands,
the text being edited might be your file itself.  In such cases the
mode line is to remind you that, although things otherwise look like
top level, you are really still inside the command; it hasn't
"finished" its work yet, and you should eventually return to it.  In
any case, if the mode line says "[ ...^R]" then when you are finished
with your editing the way to finish the command (send the message,
redefine the tab stops, etc) is to use the command Control-Altmode or
C-M-C (C-C C-C).  It will get you either back into the command, or out
of the command and back to top level, depending on the particular
command.  If you change your mind about the command (you don't want to
send the message, or change your tab stops, etc) then you should use
the command C-] to get out.

  When the text in the Mode line is surrounded by parentheses, it
means that you are inside a "Minibuffer".  {+INFO:*Note Mini: Minibuffer,
for full details on minibuffers.  }A minibuffer is a special case of
the recursive EMACS - it means that some command is requesting input.
However, it gives extra information, because all minibuffers are
handled alike in certain ways.  You can get out of a minibuffer with
a Control-G if it is empty, or with two Control-G's if it is not (the
first Control-G clears out the text in it, and the second gets out).
Or you can use C-], as with any other recursive editing level.


  When the mode line is not surrounded by parentheses or brackets, it
means that you are inside a subsystem like INFO.  Each subsystem
defines its own command language, which may not resemble ordinary
EMACS commands any more than INFO commands do.  C-Altmode MAY tell the
subsystem you are finished, and C-G or C-] @xxii[may] tell it you have
changed your mind and want to give up.  It can't be guaranteed, since
each subsystem is a separate program and must implement them itself,
but it is the convention that C-Altmode and C-] @xxii[should] work, and if
either of them fails to you may report it as a bug.  In any case, the
Help character will usually tell you what the subsystem's commands
are, including how to exit.  For example, Q is a commonly used exit

EMACS  Node: Basic, Previous: Screen, Up: Top, Next: Arguments

Chapter:Basic Editing Commands

  If the material in this node is mostly new to you, you should run
the {+ITS:TEACHE}{+Twenex:TEACH-EMACS} program to learn it.  This
{+INFO:node}{+GUIDE:chapter} is mostly a summary of what you would
learn from that program, with some other information.{*Refill:}

  To insert printing characters into the text you are editing, just
type them.  When EMACS is in its normal state, they will be stuck into
the buffer at the cursor, which will move forward.  Any characters
after the cursor will move forward too.  If the cursor is in between
a FOO and a BAR, typing XX will give you FOOXXBAR.  This method of
insertion works for printing characters and Space, but other
characters act as editing commands and do not insert themselves.  If
you need to insert a control character or Rubout, you must quote it
by typing the C-Q command first.  An Altmode can be inserted with the
command C-M-Altmode, and a ^L can be inserted with C-M-L.  A Tab
character can be inserted with Meta-Tab, but plain Tab does
mode-specific indentation.

  The most important way to make a correction is Rubout.  Rubout
deletes the character @xxii[before] the cursor (not the one that the cursor
is on top of or under;  that is the character @xxii[after] the cursor).  The
cursor and all characters after it move backwards.  You can rub out a
line boundary by typing rubout when the cursor is at the front of a

  To end a line and start typing a new one, just type "Return".  You
can also type Return to break an existing line into two.  A Rubout
after a Return will undo it.  Return really inserts two characters, a
carriage return and a linefeed, but almost everything in EMACS will
make them look like just one character, which you can think of as a
line-separator character.

indexentry:continuation line
  If you add too many characters to one line, without breaking it with
a Return, the line will grow to occupy two (or more) lines on the
screen, with a "!" at the extreme right margin of all but the last of
them.  The "!" says that the following screen line is not really a
distinct line in the file, but just the "continuation" of a line too
long to fit the screen.

  To do more than this, you have to know how to move the cursor
around.  Here are some of the characters provided for doing that.

	C-A	moves to the beginning of the line.
	C-E	moves to the end of the line.
	C-F	moves forward over one character.
	C-B	moves backward over one character.
	C-N	moves down one line, vertically.  If you start in the
		middle of one line, you end in the middle of the next.
		From the last line of text, it creates a new line.
	C-P	moves up one line, vertically.
	C-L	clears the screen and reprints everything.
		C-U C-L reprints just the line that the cursor is on.
	C-T	transposes two characters
		(the ones before and after point).
	M-<	moves to the top of your text.
	M->	moves to the end of your text.

Indexentry:files,C-X C-V,visiting,C-X C-S
  With these commands, you can do anything.  The other commands just
make things easier.  But to keep any text permanently you must put it
in a file.  You do that by choosing a filename, such as FOO, and
typing C-X C-V FOO<cr>.  This "visits" the file FOO {+ITS:(actually,
DSK:FOO > on your working directory)} so that its contents appear on
the screen for editing.  You can make changes, and then type C-X C-S
to make them permanent and actually change the file FOO.  Until then,
the changes were only inside your EMACS, and the file FOO was not
really changed.  If the file FOO doesn't exist, and you want to create
it, that's no problem;  just visit it as if it did exist.  When you
save your text with C-X C-S the file will be created.{*Refill:}
  Of course, there is a lot more to learn about using files.
*Note Files: Files.
Indexentry:C-O,C-X C-O,blank lines
  One thing you should know is that it is much more efficient to
insert text at the end of a line than in the middle.  So if you want
to stick a new line before an existing one, it is better to make a
blank line there first and then type the text into it, rather than
just go to the beginning, insert the text, and then insert a line
boundary.  It will also be clearer what is going on while you are in
the middle.  To make a blank line, you could type Return and then two
C-B's.  There is an abbreviation: C-O.  So instead of typing FOO
Return, type C-O FOO.  If you want to insert many lines, you should
type many C-O's at the beginning (or you can give C-O an "argument" to
tell it how many blank lines to make.  {+INFO:*Note Arg: Arguments, for
info).  }You can then insert the lines of text, and you will notice
that Return behaves strangely: it "uses up" the blank lines instead of
pushing them down.  When you type a Return at the end of a line, if
the following line is blank, and the line after is also blank or
doesn't exist, then the following blank line is used up instead of a
new line.  This is so that EMACS can save itself the trouble of moving
the non-blank lines that follow them.  Lines that contain only spaces,
and look blank, act just the same as lines that are really empty.  If
you don't use up all the blank lines, you can type C-X C-O (^R Delete
Blank Lines) to get rid of all but one.

EMACS  Node: Arguments, Previous: Basic, Up: Top, Next: Mark

Chapter:Giving Numeric Arguments to EMACS Commands
Indexentry:numeric arguments

  Any EMACS command can be given a numeric argument.  Some commands
interpret the argument as a repetition count.  For example, giving an
argument of ten to the C-F command (move forward one character) will
move forward ten characters.  With the C-F command, no argument is
equivalent to an argument of one.

  Some commands care only about whether there is an argument, and not
about its value;  for example, the command M-G with no arguments fills
text, but with an argument justifies the text as well.

  Some commands use the value of the argument, but do something
peculiar when there is no argument.  For example, the C-K command with
an argument <n> will kill <n> lines and the line separators that
follow them.  But C-K with no argument is special;  it kills the text
up to the next line separator (CRLF), or, if point is right before the
CRLF, it kills the CRLF.  Thus, two C-K commands with no arguments are
equivalent to a C-K command with an argument of one.

  On terminals with Meta keys, entering any argument is easy.  Simply
type the digits of the argument, with the Control or Meta key held
down (or both).  The argument must precede the command it is intended
for.  To give a negative argument, type a "-", again with the Control
or Meta key held down, before the digits.

  On other terminals, an argument can be entered by typing
Altmode followed by an optional minus sign, and the digits.  The next
non-digit is assumed to be the command for which the argument was
intended.  This works only on terminals which do @xxii[not] have Meta keys,
for technical reasons.

  A way of specifying an argument that will work the same on all
terminals is to use the C-U command followed by the optional minus
sign and the digits.  C-U followed by a non-digit other than "-" has
the special meaning of "multiply by four".  Such a C-U multiplies the
argument for the next command by four.  Two such C-U's will multiply
it by sixteen.  Thus, C-U C-U C-F would move forward sixteen
characters.  It is a good way to move forward "fast", since it moves
about 1/4 of a line on most terminals.  Other useful combinations are
C-U C-N, C-U C-U C-N (move down a good fraction of a screen), C-U C-U
C-O (make "a lot" of blank lines), and C-U C-K (kill four lines).
With some commands like M-Q that care whether there is an argument but
not what the value is, a plain C-U is a good way of saying "I want an

  Again, a few commands treat a plain C-U differently from an ordinary
argument.  A few others may treat an argument of just a minus sign
differently from an argument of -1.  These unusual cases will be
described when they come up; they are always for reasons of utility.

Subsection:Autoarg Mode

Indexentry:autoarg mode
  Users of ASCII keyboards may prefer to operate in "Autoarg" mode,
in which digits preceding an ordinary inserting character are
themselves inserted, but digits preceding an Altmode or control
character serve as an argument to it and are not inserted.  To turn on
this mode, use M-X Edit Options to set the variable Autoarg Mode
nonzero.  Autoargument digits will echo at the bottom of the screen;
the first nondigit will cause them to be inserted or will use them as
an argument.  To insert some digits and nothing else, you must follow
them with a space and then rub out the space.  C-G will cancel the
digits, while Rubout will insert them all and then rub out the last.

EMACS  Node: Mark, Previous: Arguments, Up: Top, Next: Killing

Chapter:The Mark and the Region

	C-@@		Set the mark where point is.
	C-Space		The same.
	C-X C-X		Interchange mark and point.
	M-@@		Set mark after end of next word.
	C-M-@@		Set mark after end of next s-expression.
	C-<		Set mark at beginning of buffer.
	C->		Set mark at end of buffer.
	M-H		Put region around current paragraph.
	C-M-H		Put region around current DEFUN.
	C-X H		Put region around entire buffer.
	C-X C-P		Put region around current page.

indexentry:C-X C-U
  In general, a command which processes an arbitrary part of the
buffer must be able to be told where to start and where to stop.  In
EMACS, such commands start at the pointer and end at a place called
the "Mark".  This range of text is called "the Region".  For example,
if you wish to convert part of the buffer to all upper-case with the
C-X C-U command, you could first set go to the beginning of the text
to be capitalized, put the mark there, move to the end, and then issue
the C-X C-U command.  Or, you could set the mark at the end of the
text, move to the beginning, and then issue the C-X C-U.  C-X C-U's
full name is ^R Uppercase Region, signifying that the Region, or
everything between point and the mark, is capitalized.

  The most common way to set the mark is with the C-@@ command or the
C-Space command (^R Set/Pop Mark).  They set the mark where the
pointer is.  Then you can move the pointer away, leaving the mark

  It isn't actually possible to type C-Space on non-Meta keyboards.
Yet on many terminals the command appears to work anyway!  This is
because trying to type a Control-Space on those terminals will
actually send a C-@@, which is an equivalent command.  A few keyboards
will just send a space.  If you have one of them, you suffer, or
customize your EMACS.

indexentry:C-X C-X
  Since terminals have only one cursor, there is no way for EMACS to
show you where the mark is located.  You just have to remember.  The
solution to this problem is usually simply to set the mark and then
use it soon before you have any chance to forget.  But you can see
where the mark is with the command C-X C-X (^R Exchange Point and
Mark) which puts the mark where point was and point where the mark
was.  Thus, the previous location of the mark is shown, but the Region
specified is not changed.  C-X C-X is also useful when you are
satisfied with the location of point but want to move the other end of
the Region; just do C-X C-X to put point at that end and then you can
adjust it.  The end of the region which is at point can be moved,
while the end which is at the mark stays fixed.

Section:Commands to Mark Textual Objects

  There are commands for placing the mark on the other side of a
certain object such as a word or a list, without actually having to go
there.  M-@@ (^R Mark Word) puts the mark at the end of the next word,
while C-M-@@ (^R Mark Sexp) puts it at the end of the next
s-expression.  C-> (^R Mark End) puts the mark at the end of the
buffer, while C-< (^R Mark beginning) puts it at the beginning.  These
characters allow you to save a little typing, sometimes.

Indexentry:paragraphs,DEFUNs,pages,M-H,C-M-H,C-X C-P,C-X H
  Other commands set both point and mark, to delimit an object in the
buffer.  M-H (^R Mark Paragraph) puts point at the beginning of the
paragraph it was inside of (or before), and puts the mark at the end.
M-H does all that's necessary if you wish to indent, case-convert, or
kill a whole paragraph.  C-M-H (^R Mark Defun) similarly puts point
before and the mark after the current or next DEFUN.  C-X C-P (^R Mark
Page) puts point before the current page (or the next or previous,
according to the argument), and mark at the end.  The mark goes after
the terminating page delimiter (to include it), while point goes after
the preceding page delimiter (to exclude it).  Finally, C-X H (^R Mark
Whole Buffer) delimits the entire buffer by putting point at the
beginning and the mark at the end.

Section:The Ring Buffer of Marks

  Aside from delimiting the region, the mark is also useful for
remembering a spot that you may want to go back to.  To make this
feature more useful, 16 previous locations of the mark are remembered.
Most commands that set the mark push the old mark onto this stack.
To revisit a marked location, use the C-@@ or C-Space command with an
argument, as in C-U C-@@.  This puts point where the mark was, like
C-X C-X, but whereas C-X C-X puts the mark where the point was,
C-U C-@@ pops the previous mark off the stack.  Thus, successive
C-U C-@@'s will revisit previous marks.  The stack is actually cyclic, 
so that enough C-U C-@@'s will return to the starting Point.

Indexentry:Auto Push Point Option,Auto Push Point Notification
  Some commands whose primary purpose is to move point a great
distance take advantage of the stack of marks to give you a way to
undo the command.  The best example is M-<, which moves to the
beginning of the buffer.  It sets the mark first, so that you can use
C-U C-@@ later to go back to where you were.  Searches sometimes set
the mark - it depends on how far they move.  Because of this
uncertainty, searches type out "^@@" if they set the mark.  The normal
situation is that searches leave the mark behind if they move at least
500 characters, but the user can change that value since it is kept in
the variable Auto Push Point Option.  By setting it to 0, the user can
make all searches set the mark.  By setting it to a very large number
such as ten million, he can prevent all searches from setting the
mark.  The string to be typed out when this option does its thing is
kept in the variable Auto Push Point Notification.

EMACS  Node: Killing, Previous: Mark, Up: Top, Next: Un-killing

{+INFO:Deletion and Killing}{+Guide:@chapter(Killing and Moving Text)

  The commonest way of moving or copying text with EMACS is to kill
it, and get it back again in one or more places.  This is very safe
because last several pieces of killed text are all remembered, and it
is versatile, because the many commands for killing syntactic units
can also be used for moving those units.  There are also other ways of
moving text good for special purposes.

@section(Deletion and Killing)
Indexentry:M-D,M-Rubout,C-M-K,C-M-Rubout,C-X Rubout,M-K

	C-D		Delete next character.
	Rubout		Delete previous character.
	C-K		Kill rest of line or one or more lines.
	C-W		Kill region (ie, from point to mark).
	M-D		Kill a word.
	M-Rubout	Kill a word backwards.
	C-X Rubout	Kill sentence backwards.
	M-K		Kill entire sentence.
	C-M-K		Kill s-expression.
	C-M-Rubout	Kill s-expression backwards.

  EMACS has several commands that erase variously sized blocks of
text from the buffer.  Most of them save the erased text so that
it can be restored if the user changes his mind, or moved or copied
to other parts of the file.  These commands are known as "kill"
commands.  The rest of the commands that erase text do not save it;
they are known as "delete" commands.  The commands which delete
instead of killing are the single-character delete commands C-D
and Rubout, and those commands that delete only Spaces or CRLFs.
Commands that can destroy significant amounts of nontrivial data
generally kill.  The commands' names and individual descriptions
use the words "kill" and "delete" to say which they do.  If you do a
kill command by mistake, you can use the Undo command to undo it.{+INFO:
*Note Undo: Undo.}

Indexentry:blank lines
  The simplest kill command is the C-K command (^R Kill Line).
If given at the beginning of a line, it kills all the text on the
line, leaving it blank.  If given on a blank line, the blank line
disappears.  As a consequence, if you go to the front of a non-blank
line and type two C-K's, the line disappears completely.

  More generally, C-K kills from the pointer up to the end of the line,
unless it is at the end of a line, in which case the CRLF separating
the line from the following one is killed, thus merging the next line
into the current one.  Invisible Spaces and Tabs at the end of the
line are ignored when making this decision, so if it looks like point
is at the end of the line you can count on it.

Indexentry:numeric arguments
  C-K with an argument of zero kills all the text before the pointer
on the current line.

  If C-K is given a positive argument, it kills that many lines, and
the CRLFs that end them (however, text on the current line before
the pointer is spared).  With a negative argument, -5 for example,
all text before the pointer on the current line, and all of the
five preceding lines, are killed.

  The most basic delete commands are C-D and Rubout.  C-D deletes the
character after the cursor - the one the cursor is "on top of" or
"underneath".  The cursor doesn't move.  Rubout deletes the character
before the cursor, and moves the cursor back over it.  Actually, C-D
and Rubout aren't always delete commands; if you give an argument,
they kill instead.  This prevents you from losing a great deal of text
by typing a large argument to a C-D or Rubout.

  A kill command which is very general is C-W (^R Kill Region),
which kills everything between point and the mark.  With this
command, you can kill any contiguous characters, if you set
the mark at one end of them and go to the other end, first.
A function ^R Delete Region used to exist, but it was too dangerous.

EMACS  Node: Un-Killing, Previous: Killing, Up: Top, Next: Copying

Indexentry:killing,undo,moving text,kill ring

	C-Y	Yank (re-insert) last killed text.
	M-Y	Replace re-inserted killed text with the
		 previously killed text.
	M-W	Save region as last killed text without killing.
	C-M-W	Append next kill to last batch of killed text.

  Killed text is pushed onto a ring buffer that remembers the last 8
blocks of text that were killed.  (Why it is called a "ring buffer"
will be explained below).  The command C-Y (^R Un-kill) inserts into
the buffer the text of the most recent kill.  It leaves the cursor at
the end of the text, and puts the mark at the beginning.  Thus, a
single C-W will undo the C-Y (M-X Undo will also do so).  C-U C-Y
leaves the cursor in front of the text, and the mark after.  This is
only if the argument is specified with just a C-U, precisely.  Any
other sort of argument, including C-U and digits, has an effect
described below.

  If you wish to copy a block of text, you might want to use M-W,
which copies the region into the kill ring without removing it from
the buffer.  This is approximately equivalent to C-W followed by C-Y,
except that M-W will not mark the file as "changed".  This may be
convenient when copying the text into another file.

  Normally, each kill command pushes a new block onto the kill ring.
However, two or more kill commands in a row combine their text into a
single entry on the ring, so that a single C-Y command will get it all
back just as it was before it was killed.  (Thus we join TV in leading
people to kill thoughtlessly).  If a kill command is separated from
the last kill command by other commands, it will start a new entry on
the kill ring unless you tell it not to by saying C-M-W (^R Append Next
Kill) in front of it.  The C-M-W tells the following command, if it is
a kill command, to append the text it kills to the last killed text,
instead of pushing a new entry.

  If you wish to recover text that was killed some time ago (was not
the most recent victim), you need the Meta-Y command.  The M-Y command
should be used only after a C-Y command or another M-Y.  It takes the
un-killed text and replaces it with the text from an earlier kill.

  You can think of all the last few kills as living in a ring.  After a
C-Y command, the text at the front of the ring is also present in the
buffer.  M-Y "rotates" the ring, bringing the previous string of text
to the front, and this text replaces the other text in the buffer as
well.  Enough M-Y commands can rotate any part of the ring to the
front, so you can get at any killed text as long as it was not too
long dead.  Eventually the ring would rotate all the way around and
the most recent killed text would come to the front (and into the
buffer) again.  M-Y with a negative argument rotates the ring
backwards.  If the region doesn't match the text at the front of the
ring, M-Y is not allowed.

  In any case, when the text you are looking for is brought into the
buffer, you can stop doing M-Y's and it will stay there.  It's really
just a copy of what's at the front of the ring, so editing it will not
change what's in the ring.  And the ring, once rotated, stays rotated,
so that doing another C-Y will get another copy of what you rotated to
the front with M-Y.

  If you change your mind about un-killing, a C-W or M-X Undo will get
rid of the un-killed text at any point, after any number of M-W's.

Indexentry:numeric arguments
  If you know how many M-Y's it would take to find the text you want,
then there is an alternative.  C-Y with an argument greater than one
restores the text the specified number of entries down on the ring.
Thus, C-U 2 C-Y is gets the next to the last block of killed text.  It
differs from C-Y M-Y in that C-U 2 C-Y does not actually rotate the

EMACS  Node: Copying, Previous: Un-killing, Up: Top, Next: M-X

Section:Other Ways of Copying Text

  Usually we copy or move text by killing it and un-killing it, but
there are other ways that are useful for copying one block of text in
many places, or for copying many scattered blocks of text into one

Subsection:Accumulating Text
Indexentry:C-X A,^R Append to Buffer,Append to File,Prepend to File

  You can accumulate blocks of text from scattered locations either
into a buffer or into a file if you like.  To append them into a
buffer, use the command C-X A<buffername><cr> (^R Append to Buffer),
which inserts a copy of the region into the specified buffer at its
pointer.  Successive uses of C-X A accumulate the text in the
specified buffer in the same order as they were copied.

  To accumulate text into a file, use the command M-X Append to
File<filename><cr>.  It adds the text of the region to the end of the
specified file.  M-X Prepend to File adds the text to the beginning of
the file instead.

Subsection:Copying Text Many Times
Indexentry:C-X X,C-X G,^R Put Q-reg,^R Get Q-reg,q-registers,TECO,MM

  When you want to copy one piece of text into the buffer from time to
time during your editing, the kill ring becomes impractical, since the
text will move down on the ring as you edit, and will be in an
unpredictable place on the ring when you need it again.  For this
case, you can use the commands C-X X (^R Put Q-register) and C-X G (^R
Get Q-register) to move the text.

  C-X X<q> stores a copy of the region in q-register <q>.  <q> can be
a letter or a number.  This actually uses the TECO q-register of the
same name!  An argument makes it delete the text as well.  C-X G<q>
inserts in the buffer the text from q-register <q>.  An argument makes
it put point after the text and the mark before the text.

  You might prefer not to use q-registers M and R in this way, if you
are going to want to use the TECO commands MM and MR.

EMACS  Node: M-X, Previous: Copying, Up: Top, Next: Help

Chapter:Extended (Meta-X) Commands and Functions
Indexentry:extended commands,M-X,functions,commands

  While the most often useful EMACS commands are accessible via one or
two characters, the less often used commands go by long names to make
them easier to remember.  They are known as "extended commands"
because they extend the set of two-character commands.  They are also
called "M-X commands", because they all start with the character
Meta-X (^R Extended Command).  The M-X is followed by the command's
name, actually the name of a function to be called.  Terminate the
name of the function with a Return (unless you are supplying string
arguments -- see below).  For example, the function List Commands
would be invoked by Meta-X List Commands<cr>.  At that point, it would
execute and print out a list of all extended commands (all functions
you are likely to want to call) and one line of documentation for

  We say that M-X Foo<cr> calls "the function FOO".  When documenting
the individual extended commands, we will call them "functions" to
avoid confusion between them and the one or two character "commands".
We will also use "M-X" as a title like "Mr." for functions, as in
"use M-X Foo".  The "extended command" is what you @XXi[type],
starting with M-X, and what the command @XXI[does] is call a function.
The name that goes in the command is the name of the command and is
also the name of the function, and both terms will be used.

Indexentry:Rubout,C-D,C-U,C-G,echo area
  When you type M-X, you will see the cursor move down to the echo
area at the bottom of the screen.  "MM" will be printed there, and
when you type the command name it will echo there.  This is known as
"reading a line in the echo area".  You can use Rubout to cancel one
character of the command name, or C-U or C-D to cancel the entire
command name.  A C-G will cancel the whole M-X, and so will a Rubout
when the command name is empty.  These editing characters apply to
anything which reads a line in the echo area.

Indexentry:command completion,Altmode,Space
  You can abbreviate the name of the command, as long as the
abbreviation is unambiguous.  If the name you specify is ambiguous or
impossible, you will get an error message.  You can also use
completion on the function name.  Typing Altmode asks to complete the
entire function name, or as much as is possible.  Typing Space asks to
complete only the current or next word.  Note that Altmode has the
additional function of separating the function name from any string

  The string (in this case, "MM") which appears in the echo area is
called a "prompt".  The prompt always tells you what sort of argument
is required and what it is going to be used for; "MM" means that you
should type the name of a function to be called.  This particular
prompt may seem obscure.  "MM" is the way a TECO program calls a
function.  In the early days of EMACS, before there was a command M-X,
the only way to issue an extended command was to get a minibuffer and
type the "MM" by hand.  So when M-X was invented, everyone knew what
the "MM" meant.  Nowadays, it isn't so meaningful, but nobody has come
up with a better alternative.  The obvious ones ("M-X", "Cmd",
"Extended") have disadvantages too.

Indexentry:numeric arguments
  Some functions can use numeric prefix arguments.  Simply give the
Meta-X command an argument and Meta-X will pass it along to the
function which it calls.  The argument will appear before the "MM" in
the prompt, so you don't forget it was typed.

Indexentry:string arguments
  Some functions require "string arguments" or "suffix arguments".
For those functions, the function name should be terminated with a
single Altmode, after which should come the arguments, separated by
Altmodes.  After the last argument, type a Return to cause the
function to be executed.  For example, the function Describe prints
the full documentation of a function (or a variable) whose name must
be given as a string argument.  An example of using it would be Meta-X
DescribeApropos<cr>, which would print the full description of the
function named Apropos.

  The last few extended commands you have executed are saved and you
can repeat them.  We say that the extended command is saved, rather
than that the function is saved, because the whole command, including
arguments, is saved.

Indexentry:minibuffer,C-X Altmode
  To re-execute a saved command, use the command C-X Altmode (^R
Re-execute Minibuffer).  It will retype the last extended command and
ask for confirmation.  With an argument, it will repeat an earlier
extended command; 2 means repeat the next to the last command, etc.
You can also use the minibuffer to edit a previous extended command
and re-execute it with changes.{+INFO:  *Note Mini: Minibuffer.}

  An alternate way of calling extended commands is with the command
C-M-X (^R Instant Extended Command).  It differs from plain M-X in
that the function itself reads any string arguments.  This can be
useful if the string argument is a filename or a command name, because
the function will know that and give the argument special treatment
such as completion.  However, there are compensating disadvantages.
For one thing, since the function has already been invoked, you can't
rub out from the arguments into the function name.  For another, it is
not possible to save the whole thing - function name and arguments -
for you to recall with C-X Altmode.  So C-M-X saves @xxi[nothing] for
C-X Altmode.

Note: Extended commands and functions were once called "MM commands",
but this term is obsolete.  If you see it in any user documentation,
please report it.  Ordinary one or two character commands used to be
known as "^R" commands, and the term may still be used in the online
documentation of some functions; please report this also.{+INFO:
*Note MM: MMArcana, for more information on this and other topics
related to how extended commands work, how they are really the
foundation of everything in EMACS, and how they relate to

EMACS  Node: MMArcana, Up: M-X, Previous: M-X

Section:Arcane Information about M-X Commands

  MM commands are called that, even though you usually run them by
typing Meta-X and never say "MM" yourself, because "MM" is the TECO
expression which looks up a command name to find the associated
program, and runs that program.  Thus, the TECO expression{+Guide:@~}

	MM AproposWord

means to run the Apropos command with the argument "word".  You could
type this expression into a minibuffer and get the same results as you
would get from Meta-X AproposWord<cr>.  In fact, for the first year
or so, EMACS had no Meta-X command, and that's what people did.{+INFO:
*Note Mini: Minibuffer.}

  "MM" actually tells TECO to run the program in q-register "M".  This
program takes a string argument to be the name of a function and looks
it up.  Calling a function is built into TECO, but looking up the name
is not; it is implemented by the program TECO calls "M".  That's why
"MM" is called that and not "Run" or "F^Q".

Indexentry:numeric arguments
  Functions can use one or two "prefix arguments" or "numeric
arguments".  These are numbers (actually, TECO expressions) which go
before the "MM".  Meta-X can only give the MM command one argument.
If you want to give it two, you must type it in using the minibuffer.
When TECO code passes prefix arguments, they don't have to be numbers;
they can also be string pointers, TECO buffer objects, etc.  However,
no more about that here.

Indexentry:string arguments
  When TECO code passes a string argument, it appears terminated by an
Altmode after the Altmode which ends the function name.  There can be
any number of string arguments.  In fact, the function can decide at
run time how many string arguments to read.  This makes it impossible
to compile TECO code!

  Actually, @xxi[every] command in EMACS simply runs a function.  For
example, when you type the command C-N, it runs the function "^R Down
Real Line".  You could just as well do C-U 1 M-X ^R Down Real Line<cr>
and get the same effect.  C-N can be thought of as a sort of
abbreviation.  We say that the command C-N has been "connected" to the
function ^R Down Real Line.  The name is looked up once when the
command and function are connected, so that it does not have to be
looked up again each time the command is used.  For historical
reasons, the default argument passed to a function which is connected
to a command you typed is 1, but the default for MM and for M-X is 0.
This is why the C-U 1 was necessary in the example above.  The
documentation for individual EMACS commands usually gives the name of
the function which really implements the command in parentheses after
the command itself.  The function names also appear in the EMACS wall
chart as "documentation" for the character commands.

  Just as any function can be called directly with M-X, so almost any
function can be connected to a command.  This is the basis of
customization of EMACS.  You can use the function Set Key to do this.
To define C-N, you could type M-X Set Key^R Down Real Line<cr>, and
then type C-N.  If you use the function View File often,
you could connect it to the command C-X V (not normally defined).  You
could even connect it to the command C-M-V, replacing that command's
normal definition.  This can be done with the function Set Key; or you
can use an init file to do it permanently.{+INFO: *Note Init: Init.}

Indexentry:command completion
  EMACS is composed of a large number of functions, each with a name.
Some of these functions are connected to commands; some are there for
you to call with M-X; some are called by other functions.  The last
group are called subroutines.  They usually have names starting with
"&", as in "& Read Line", the subroutine which reads a line in the
echo area.  Although most subroutines have such names, any function
can be called as a subroutine.  Functions like ^R Down Real Line have
names starting with ^R because the user is not expected to call them
directly, either.  The purpose of the "&" or "^R" is to get those
function names out of the way of command completion in M-X.  M-X
allows the command name to be abbreviated if the abbreviation is
unique, and the commands that the user isn't interested in might have
names that would interfere and make some useful abbreviation cease to
be unique.  The funny characters at the front of the name prevent
this from happening.

Indexentry:BARE library,Help
  You should not be surprised when some function names, present as
definitions of single-character commands, are known to all the Help
features but don't seem to exist if you try to call them by name.
The names of these functions are not always defined; they are contained
in a library called BARE which is loaded temporarily by each
documentation command and then flushed again.  The reason for this is
that these functions are really built into TECO and not part of EMACS;
the EMACS "definitions" aren't necessary for actually using them, and
are only there for the sake of documentation.
If you load BARE permanently, then you can refer to these functions by
name like all others.

  M-X List Commands lists only the functions that are primarily
provided to be run by name with a Meta-X.  Functions whose expected
major use is to be connected to a command, and functions intended
primarily to be called by other functions, are not mentioned.  To see
a list of them, use M-X List ^R Commands or M-X List Subroutines.

EMACS  Node: Help, Previous: M-X, Up: Top, Next: Unwedging

Chapter:Self-Documentation Commands

  EMACS provides extensive self-documentation features which revolve
around a single character, called the Help character.  At any time
while using EMACS, you can type the Help character to ask for help.
Just what the Help character is depends on which terminal you are
using, but aside from that the same character always does the trick.
{+ITS:If your keyboard has a key labeled Help (above the H), type that
key (together with the Top key).  }{+ITS:Otherwise you}{+Twenex: you}
should type the character {+Twenex:C-_ (Control-Underscore).}{+ITS:C-_
(Control-Underscore) followed by an H (this is two characters to type,
but let's not worry about that).}  Whatever it is you have to type, to
EMACS it is just the Help character.{*Refill:}

  If you type Help while you are using a subsystem such as INFO, it
will give you a list of the commands of that subsystem.

  If you type Help in the middle of a multi-character command, it will
often tell you about what sort of thing you should type next.  For
example, if you type M-X and then Help, it will tell you about M-X and
how to type the name of the command.  If you finish the function name
and the Altmode and then type Help, it will tell you about the function
you have specified so you can know what arguments it needs.  If you
type C-X and then type Help, it will tell you about the C-X commands.

  But normally, when it's time for you to start typing a new command,
Help will offer you several options for asking about what commands
there are and what they do.  It will print "Doc (? for help):" at the
bottom of the screen, and you should type a character to say what kind
of help you want.  You could type Help at this point to find out
what options are available.  But the most useful of them are described

  The most basic Help options are Help C and Help D@: You can use them
to ask what a particular command does.  Help C is for character
commands; just type the command you want to know about after the Help
and the "C" ("C" stands for Character).  Thus, Help C M-F would tell
you about the M-F command.  Help D is for asking about functions; type
the name of the function and a Return.  Thus, Help D Lisp Mode<cr>
would tell you about M-X Lisp Mode.  "D" stands for "Describe", since
Help D actually uses the function Describe to do the work.

  A more complicated sort of question to ask is, "what are the
commands for working with files"?  For this, you can type Help A,
followed by the string "file" and a Return.  It will print a list of
all the functions that have "file" in their names, including Save All
Files, ^R Save File, Append to File, etc.  If some of the functions
are connected to commands, it will tell you.  For example, it would
say that you can invoke ^R Save File by typing C-X C-S.  "A" stands
for "Apropos", since Help A actually uses the function Apropos to do
the substring matching.  Only functions that are expected to be of
interest to users will be listed.  To get subroutines to be included
as well, you must run M-X Apropos yourself.

  If you aren't sure what characters you accidentally typed to produce
surprising results, you can use Help L to find out ("L" stands for
"What Lossage").  When you see commands that you don't know, you can
use Help C to find out what they did.

  If a command doesn't do what you thought you knew it should do, you
can ask to see whether it has changed recently.  Help N prints out the
file called {+ITS:EMACS;EMACS NEWS}{+Twenex:EMACS:EMACS.NEWS} which is
an archive of announcements of changes to EMACS.{*Refill:}

  To find out about the other Help options, type Help Help.  That is,
when the first Help asks for an option, type Help to ask what is

  Finally, you should know about the documentation files for EMACS, which are
version of this INFO documentation formatted to be printed out on a
terminal or line printer.  EMACS{+ITS: }{+Twenex:.}CHART has a brief
description of all the commands, and is good to post on the
wall near your terminal.{*Refill:}

EMACS  Node: Unwedging, Previous: Help, Up: Top, Next: Undo

Chapter:Getting EMACS out of Wedged or Undesirable States

  There are four general "quitting" procedures in EMACS:  C-G, C-],
M-X Top Level, and restarting.  The last is a drastic one for use when
C-G does not work.  All three have different uses.

  C-G is the most common way of quitting.  It is used for getting rid
of a partially typed command, or a numeric argument that you don't
want.  It will also stop a running command in the middle in a
relatively safe way, so you can use it if you accidentally give a
command which takes a long time.   In particular, it is safe to quit
out of killing; either your text will @xxii[all] still be there, or it will
@xxii[all] be in the kill ring.

Indexentry:recursive editing level
  However, C-G will not quit out of recursive editing levels, or out
of subsystems such as INFO.  This is because it is useful to be able
to quit commands within the subsystem.  For example, you can use C-G
to flush a partially typed INFO command without worrying that it may
take you all the way out of INFO.  If you are editing a message to be
sent, you can flush a partial command with C-G and have no fear of
quitting out of editing the message.  The way to quit out of such
subsystems is to use the C-] command (Abort Recursive Edit), which
quits out of one level of subsystem or recursive edit.  Thus, it is
the way to abort sending a message.  C-] will either tell you how to
resume the aborted command or query for confirmation before aborting.

Indexentry:Top Level
  When you are in a position to use M-X, you can use M-X Top Level.
This is equivalent to "enough" C-] commands to get you out of all the
levels of subsystems and recursive edits that you are in.  C-] gets
you out one level at a time, but M-X Top Level goes out all levels at

  Normally, you won't need to do anything else to get EMACS out of
strange states.  However, sometimes you will need to restart it.  This
is because C-G always takes effect between the TECO commands which
make up an EMACS program, never in the middle of one (though a few long
commands allow quitting at any time), so as to prevent TECO from being
destroyed.  However, sometimes EMACS will be hung inside a TECO
command (if, for example, TECO is waiting in the middle of reading in
a file).  In such a case, C-G will not work, but the more drastic
procedure of restarting TECO may work.  Type {+ITS:CALL or C-Z}
{+Twenex:Control-C} to stop EMACS, then {+ITS:G}{+Twenex:START} to
restart it.  While restarting TECO in this way is usually
safe (especially at times when TECO is doing I/O), there are certain
times at which it will cause the TECO data structures to be
inconsistent, so do not try it unless other measures have failed.{*Refill:}

Section:What to Do if EMACS Acts Strangely
Indexentry:terminal type
{+guide:{+Twenex:@Index[Set Terminal Type]}
  If EMACS displays garbage on the screen, or if it outputs the right
things but scattered around all the wrong places on the screen, it may
be that EMACS has the wrong idea of your terminal type.  The first
thing to do in this case is to exit from EMACS and restart it.  Each
time EMACS is restarted it asks the system what terminal type you are
using.  Whenever you detach and move to a terminal of a different type
you should restart EMACS as a matter of course.  If you stopped EMACS
when it was trying to read from the terminal, or by typing an EMACS
exit command, then this is sure to be safe.  The system may not know
what type of terminal you have.  You should try telling the system
with the {+ITS::TCTYP command.}{+Twenex:TERMINAL TYPE command.
If your terminal is compatible with one of the standard types but has
a different size screen, you must tell the system the size with the
whatever size the system says it knows.{*Refill:}

  However, the system may not even have a type code defined for your
terminal.  In this case, as long as EMACS knows about your type of
terminal, you can still win.  Do M-X Set Terminal Type<type><cr>
where <type> stands for the EMACS name of your type of terminal.  Get
a list of all types known by doing M-X List LibraryTRMTYP<cr>.  EMACS
will STILL get the size of the screen from the system, so you are not
relieved of responsibility for using the TERMINAL WIDTH and TERMINAL
LENGTH commands.  Also, if you restart EMACS (as opposed to continuing
it), you will have to specify the terminal type again, since EMACS
will have asked the system again.}

  If you find that EMACS is not responding to your commands except for
echoing them all at the bottom of the screen, including the Return
character, and that Rubout causes erased characters to be retyped
instead of erased, then you have managed to exit from EMACS back to
TECO.  You can get back in by typing :M..L, or by restarting EMACS.
If you want to exit back to TECO, you can do M-X Top Level with an
argument greater than zero.

EMACS  Node: Undo, Previous: Unwedging, Up: Top, Next: Bugs

Section:Undoing Changes to the Buffer

  If you mistakenly issue commands that make a great change to the
buffer, you can often undo the change without having to know precisely
how it came about.  This is done by using M-X Undo.  Just type M-X
Undo<cr> and the change will be undone.  It does not matter if you
have moved the cursor since you made the change; it will be undone
where it was originally done.  Before actually undoing, Undo will
query you, telling what sort of change (kill, fill, undo,
case-convert, etc) it will undo if you tell it to go ahead.  If you
say "Y", the change is actually undone.

  Not all changes to the buffer can be undone: deletion (as opposed to
killing) can't be, and changes in indentation can't be, nor can many
forms of insertion (but they aren't as important since they don't
destroy information).  Also, a Replace String or Query Replace can't
be undone, which is a shame.  The reason is that it is actually many
small changes, and Undo only knows how to remember one contiguous
change.  Perhaps someday I will be able to fix this.

  As a result, when you say Undo, it may undo something other
than the latest change if the latest change was not undoable.
This might seem to pile one disaster on another, but it doesn't,
because you can @xxii[always] Undo the Undo if it didn't help.

  If you want to undo a considerable amount of editing, the Undo
command can't help you, but M-X Revert File might be able to.{+INFO:
*Note Revert: Revert, for details.}

EMACS  Node: Bugs, Previous: Undo, Up: Top, Next: MajorModes

Section:Reporting Bugs

  There will be times when you encounter a bug in EMACS.  To get it
fixed, you must report it.  It is your duty to do so; but you must
know when to do so and how if it is to serve any purpose.

Subsection:When Is There a Bug

  If EMACS executes an illegal instruction, or dies with an operating
system error message that indicates a problem in the program (as
opposed to "disk full"), then it is certainly a bug.

  If EMACS updates the display in a way that does not correspond to
what is in the buffer, then it is certainly a bug.  If a command seems
to do the wrong thing but the problem is gone if you type C-L, then it
is a case of incorrect display updating.

  Taking forever to complete a command can be a bug, but you must make
certain that it wasn't your own fault.  Restart EMACS and type Help L
to see whether the keyboard or line noise garbled the input; if the
input was such that you @xxii[know] it should have been processed
quickly, report a bug.  If you don't know, try to find someone who
does know.

  If a command you are familiar with causes an EMACS error message in
a case where its usual definition ought to be reasonable, it is
probably a bug.

  If a command does the wrong thing, that is a bug.  But be sure you
know for certain that what it does isn't right.  If you aren't
familiar with the command, or don't know for certain how the command
is supposed to work, then it might actually be working right.  Rather
than jumping to conclusions, show the problem to someone who knows for

  Finally, a command's intended definition may not be best for editing
with.  This is a very important sort of problem, but it is also a
matter of judgement.  Also, it is easy to come to such a conclusion
out of ignorance of some of the existing features.  It is probably
best not to complain about such a problem until you have checked the
documentation in the usual ways (INFO and Help), feel confident that
you understand it, and know for certain that what you want is not
available.  If you feel confused about the documentation instead, then
you don't have grounds for an opinion about whether the command's
definition is optimal.  You might have grounds for complaining about
the documentation; but make sure you read it through and check the
index or the menus for all references that aren't known to you before
coming to a conclusion.

Subsection:How to Report a Bug

  When you decide that there is a bug, it is important to report it
and to report it in a way which is useful.  What is most useful is an
exact description of what commands you type, starting with a fresh
EMACS just loaded, until the problem happens.  Be sure to say what
version of EMACS and TECO are running; the EMACS version can be
printed by the string QEMACS Version= in the minibuffer, and the
TECO version can be printed by the string FS VERSION= in the

  If you can cause the problem to occur in a standard EMACS, with no
init file except the default one, this will help.  If the problem does
@xxii[not] occur in a standard EMACS, it is very important to report that
fact, because otherwise we will try to debug it in a standard EMACS,
not find the problem, and tell you so.  If the problem does depend on
an init file, then you should make sure it is not a bug in the init
file by complaining to the person who wrote the file, first.  He
should check over his code, and verify the definitions of the TECO
commands he is using by looking in the TECORD file.

  If you can tell us a way cause the problem without reading in any
disk files, please do so.  This makes it much easier to debug.  If you
do need disk files, make sure you arrange for us to see their exact
contents.  If you are reporting the bug from a non-Arpanet site, keep
the disk files small, since we will have to @xxii[type them in]!

  If you are not in Fundamental mode when the problem occurs, you
should say what mode you are in.

  The most important principle in reporting a bug is to report @xxii[facts],
not hypotheses or conditions.  It is always easier to report the
facts, but people seem to prefer to strain to think up explanations
and report them instead.  If the explanations are based on guesses
about how EMACS is implemented, they will be useless; we will just
have to try to figure out what the facts must have been to lead to
such ideas.  Sometimes this is impossible.  But in any case, it is
unnecessary, since the user could have reported the raw facts.

  Thus, instead of saying "... happens when I read in a big file", say
"... happens when I type C-X C-V <GLORP>BAZ.UGH<cr>".  This way you
@xxii[know] we will be able to cause the problem.  Suppose it's not a matter
of size at all, but of having a "Z" in the filename?  We would try out
the problem with some "big file", probably with no "Z" in its name,
and not find anything wrong.  Suppose that the file actually must
contain between 130,000 and 150,000 characters to cause the problem?
For this reason, you should make sure that you don't change the file
until we have looked at it.  Suppose the problem only occurs when you
have typed the C-X C-A command previously?  This is why we ask you to
give the exact sequence of characters you typed since loading the
EMACS.  Rather than saying "if I have three characters on the line",
say "after I type <cr> A B C <cr> C-P".

  If EMACS gets an operating system error message, such as for an
illegal instruction, then you can probably recover by restarting it.
But before doing so, you should make a dump file.  {+Twenex:Consult a system
wizard for how to do this.}{+ITS:Do this by saying :PDUMP
<filenames><cr>, where you choose the filenames.}  Be sure to report
exactly all the numbers printed out with the error message.  If you
restart or continue the EMACS before saving this information, the
trail will be covered and it will probably be too late to find out
what happened.{*Refill:}

EMACS  Node: MajorModes, Previous: Bugs, Up: Top, Next: MinorModes
@Chapter(Customization: Modes and Options)
Section:Major Modes
Indexentry:major modes,Tab,Rubout,Linefeed,comments

  When EMACS starts up, it is in what is called "Fundamental Mode",
which means that the single and double character commands are defined
so as to be convenient in general.  More precisely, in Fundamental
Mode @xxi[every] EMACS option is set in its default state.  For
editing any specific type of text, such as LISP code or English text,
you can tell EMACS to change the meanings of a few commands to become
more specifically adapted to the task.  This is done by switching from
Fundamental Mode to one of the other major modes.  Most commands
remain unchanged; the ones which usually change are Tab, Rubout, and
Linefeed.  In addition, the commands which handle comments use the
mode to determine how comments are to be delimited.

Indexentry:mode line
  Selecting a new major mode is done with an M-X command.  Each major
mode is the name of the function to select that mode.  Thus, you can
enter LISP mode by executing M-X LISP (short for M-X LISP Mode).  The
major modes are mutually exclusive - you can be in only one major mode
at a time.  When at top level, EMACS always says in the Mode line
which one you are in.
  Often EMACS will enter the correct major mode for a file simply
based on the file's extension, and you will not have to worry about
selecting a mode.
  Many major modes redefine the syntactical properties of characters
appearing in the buffer.{+INFO:  *Note Syntax: Syntax.}{+Guide:  See
the section on the syntax table.}

  LISP Mode causes Tab to run the function ^R Indent for LISP, which
causes the current line to be indented according to its depth in
parentheses.  Linefeed, as usual, does a Return and a Tab, so it will
move to the next line and indent it.  Rubout is also redefined, so
that rubbing out a tab will cause it to turn into Spaces.  Thus, the
fact that Tab uses Tabs as well as Spaces to indent lines is invisible
when you try to rub the indentation out.  Comments start with ";".
When in LISP mode, the action of the word-motion commands is affected
by whether you are in Atom Word Mode or not.

  Text Mode causes Tab to run the function ^R Tab to Tab Stop, which
allows you to set any tab stops with M-X Edit Tab
Stops{+GUIDE:.}{+INFO:; for details, see *note Tab Stops: Textindent.}
In text mode, Auto Fill does not normally indent new lines that it
creates.  Comments are declared not to exist.  Automatic display of
parenthesis matching is turned off.  Finally, the meaning of "word" as
understood by the word-motion commands is changed so that "." is not
considered part of a word, while "'" is.{*Refill:}

  MIDAS Mode is for editing assembler language programs - any
assembler language.  It is very close to Fundamental Mode, but a few
special-purpose commands are provided:  C-M-A, C-M-E, C-M-N, C-M-P,
and C-M-D.{+INFO:  *Note MIDAS: MIDAS, for details.}

  MACSYMA Mode redefines the syntax of words and s-expressions in an
attempt to make it easier to move over MACSYMA syntactic units.  In
addition, the C-M-G "grind" command is told to grind text as MACSYMA
instead of as LISP.  Also, the syntax of MACSYMA comments is

  MUDDLE mode is similar to Lisp mode but uses Muddle syntax.

  TECO mode is good for editing EMACS library source files.  It makes
Tab be ^R Indent Nested (see its self-documentation).  Comments start
with "!* " and end with "!".  In addition, the PURIFY library which
contains many things useful for processing library sources (including
the commands to compile them) is loaded.  M-' and M-" are connected to
functions which move forward and backward over balanced TECO

  PL1 Mode is for editing PL1 code, and causes Tab to indent an
amount based on the previous statement type.  The body of the
implementation of PL1 Mode is in the library PL1, which is loaded
automatically when necessary.{+INFO:  *Note PL1: (EPL1).}

  PASCAL mode is similar to PL1 mode, for PASCAL.  It is in the
library called PASCAL.{+INFO:  *Note PASCAL: (EPASC).}

  There are also modes for BLISS and BCPL, but no INFO documentation
for them.

EMACS  Node: MinorModes, Previous: MajorModes, Up: Top, Next: Variables

Section:Minor Modes
Indexentry:minor modes

Indexentry:numeric arguments
  Minor modes are options which you can use or not.  They are all
independent of each other and of the selected major mode.  Each minor
mode is the name of the function that can be used to turn it on or
off.  With no argument, the function turns the mode on if it was off
and off if it was on.  This is known as "toggling".  A positive
argument always turns the mode on, and an explicit zero argument of a
negative argument always turns it off.  All the minor mode functions
are suitable for connecting to single or double character commands if
you want to enter and exit a minor mode frequently.

Indexentry:Auto Fill Mode,C-X F,Fill Column
  Auto Fill Mode allows you to type text endlessly without worrying
about the width or your screen.  Returns will be inserted where
appropriate to prevent lines from becoming too long.  The column at
which lines are broken defaults to 70, but you can set it explicitly.
C-X F (^R Set Fill Column) sets the column for breaking lines to the
column point is at; or you can give it a numeric argument which is the
desired column.  The value is stored in the variable Fill Column.

Indexentry:Auto Save Mode,Auto Save Default
  Auto Save Mode protects you against system crashes by periodically
saving the file you are visiting.  Whenever you visit a file, auto
saving will be enabled if QAuto Save Default is nonzero; in addition,
M-X Auto Save allows you to turn auto saving on or off in a given
buffer at any time.{+INFO:  *Note AutoSave: AutoSave, for more details.}

Indexentry:Atom Word Mode,Lisp
  Atom Word Mode causes the word-moving commands, in LISP mode, to
move over LISP atoms instead of words.  Some people like this, and
others don't.  In any case, the s-expression motion commands can be
used to move over atoms.  If you like to use segmented atom names like
FOOBAR-READ-IN-NEXT-INPUT-SOURCE-TO-READ, then you might prefer not to
use Atom Word Mode, so that you can use M-F to move over just part of
the atom, or C-M-F to move over the whole atom.

indexentry:Overwrite Mode,Rubout
  Overwrite Mode causes ordinary printing characters to replace
existing text instead of shoving it over.  It is good for editing
pictures.  For example, if the point is in front of the B in FOOBAR,
then in Overwrite Mode typing a G would change it to FOOGAR, instead
of making it FOOGBAR as usual.  Also, Rubout is changed to turn the
previous character into a Space instead of deleting it.

Indexentry:Word Abbrev Mode
  Word Abbrev Mode allows you to define abbreviations that
automatically expand as you type them.  For example, "wam" might
expand to "word abbrev mode".  The abbreviations may depend
on the major (e.g. LISP, TEXT, ...) mode you are currently in.  To
use this, you must load the WORDAB library.{+INFO:  To learn about this
mode, *Note WORDAB: (WORDAB).}{+GUIDE:  This mode is described in a
separate chapter later on.}

indexentry:Indent Tabs Mode
  Indent Tabs Mode controls whether indentation commands use Tabs and
Spaces or just Spaces to indent with.  Usually they use both, but you
might want to use only Spaces in a file to be processed by a program
or system which doesn't ignore tabs, or for a file to be shipped to a
system like Multics on which tab stops are not every 8 characters.

  Most minor modes are actually controlled by variables.  Setting the
minor mode with a command just changes the variable.  This means that
you can turn the modes on or off with Edit Options, make their values
local to a buffer or file, etc.{+INFO:  *Note Vars: Variables.}

EMACS	Node: Variables, Previous: MinorModes, Up: Top, Next: Init

Section:Named Variables
Indexentry:variables,options,Fill Column,Edit Options

  EMACS and TECO allow variables with arbitrary names to be defined
and given numbers or strings as values.  EMACS uses many variables
internally, but also has several whose purpose is to be set by the
user for customization.  (They may also be set automatically by major
modes.)  One example of such a variable is the Fill Column variable,
which specifies the position of the right margin (in characters from
the left margin) to be used by the fill and justify commands.
Sometimes we will use the syntax "the variable QFill Column".  The
"Q" and Altmodes form the TECO syntax for referring to a variable, and
so act as a sort of title for the name of a variable.  Don't be upset
by it.

  The easiest way for the beginner to set a named variable is to use
the function Edit Options.  This shows you a list of selected
variables which you are likely to want to change, together with their
values, and lets you edit them with the normal editing commands in a
recursive editing level.  Don't make any changes in the names, though!
Just change the values.  Just digits with maybe a minus sign stand for
a numeric value of the variable, while anything else stands for a
string value.  There is no way to have a value which is a string of
digits (at least, not using Edit Options).  When you are finished,
exit using C-C C-C or C-Altmode and the changes will take effect.
Until then, C-] will get you out with no ill effects.

Indexentry:Set Variable,numeric arguments,string arguments
  However, Edit Options can be used only to set a variable which
already exists, and is marked as an option.  Some commands may refer
to variables which do not exist in the initial environment.  Such
commands always use a default value if the variable does not exist.
In these cases you must create the variable yourself if you wish to
use it to alter the behavior of the command.  You can use M-X Set
Variable for this.  You can set the variable to a numeric value by
doing C-U <number> M-X Set Variable<varname><cr>, or to a string by
doing M-X Set Variable<varname><value><cr>.

  In fact, you can use Set Variable to set any variable, whether it
exists already or not.  For existing variables, you are allowed to
abbreviate the name as long as the abbreviation is unique.  If the
variable might not exist yet, you can't abbreviate it (how could EMACS
know what it was an abbreviation of?).

  If you want to set a variable a particular way each time you use
EMACS, you can use an init file or an EVARS file.  This is one of the
main ways of customizing EMACS for yourself.  An init file is a file
of TECO code to be executed when you start EMACS up.  They are very
general, but writing one is a black art.  You might be able to get an
expert to do it for you, or modify someone else's.
{+INFO:*Note Init: (EMACS;CONV)Init, for details.  }An EVARS file is a much
simpler thing which you can do yourself.{+INFO:  *Note EVARS: Init, for how.}

Indexentry:local variables
  Variables can be made local to an individual file.  The variable
will then magically have its local value whenever you are looking at
that file.{+INFO:  *Note Local: Locals, for how to do this.}  When making
variables local, you do not need to worry about whether the variables
already exist, because they will be created automatically.

Indexentry:List Variables,Describe
  You can get a list of all variables, not just those you are likely
to want to edit, by doing M-X List Variables.  Giving List Variables a
string argument will show you only the variables whose names or values
contain that string (like the function Apropos).  M-X Describe can be
given a variable's name instead of a command's name;  it will show the
variable's value and its documentation, if it has any.

  You can also set a variable with the TECO command <val>U<varname>,
which you can give in the minibuffer or in your init file.  This way
is probably faster for the experienced user.{+INFO:
*Note Vars: (EMACS;CONV)Variables, for more information on
manipulating variables in EMACS.

  While we are on the subject of variables, we should also mention the
syntax table.  It isn't a variable, strictly speaking, but it is
almost like one.  *Note Syntax: Syntax}

EMACS  Node: Syntax, Previous: Variables, Up: Variables

Section:The Syntax Table
Indexentry:syntax table

  All the EMACS commands which parse words or balance parentheses are
controlled by the syntax table.  Each ASCII character has a word
syntax and a Lisp syntax.  By changing the word syntax, you can
control whether a character is considered a word delimiter or part of
a word.  By changing the Lisp syntax, you can control which characters
are parentheses, which ones are parts of symbols, which ones are
prefix operators, and which ones are just ignored.

  The syntax table is actually a string which is 128*5 characters
long.  Each group of 5 consecutive characters of the syntax table
describe one ASCII character's syntax; but only the first three of
each group are used.  To edit the syntax table, use M-X Edit Syntax
Table.  But before we describe its conventions, let's talk about the
syntax of the syntax table itself.

  The first character in each group of five sets the word syntax.
This can be either "A" or a Space.  "A" signifies an alphabetic
character, whereas Space signifies a separator character.

  The second character in each group is the Lisp syntax.  It has many
possible values:

	A	an alphabetic character
	Space	a whitespace or nonsignificant character
	(	an open parenthesis
	)	a close parenthesis
	;	a comment starter
	^M	a comment ender
	|	a string quote
	/	a character quote
	'	a prefix character

  Thus, any number of characters could be given the syntax of
parentheses.  The automatic display of matching feature uses the
syntax table to decide when to go into operation as well as how to
balance the parentheses.

  The syntax of "prefix character" means that the character becomes
part of whatever object follows it, or can also be in the middle of a
symbol, but does not constitute anything by itself if surrounded by

  A character quote character causes itself and the next character to
be treated as alphabetic.

  A string quote is one which matches in pairs.  All characters inside
a pair of string quotes are treated as alphabetic except for the
character quote, which retains its significance, and can be used to
force a string quote or character quote into a string.

  The comment starter and comment ender match each other in pairs, but
suppress the normal syntax of all characters between.  However, not
all commands know about these.  Also, the syntax table entry is not
what controls the commands which deal specifically with comments.
They use the variables Comment Start, Comment Begin, Comment End, etc.

  The third character in each group exists specifically for automatic
parenthesis matching display.  It is defined only for characters which
have the Lisp syntax of close parentheses, and for them it should
contain the appropriate matching open parenthesis character (or a
Space).  If the close parenthesis character is matched by the wrong
kind of open parenthesis character, the bell will ring.  If the syntax
table contains a Space here, any open parenthesis is allowed to match.

  The fourth and fifth characters in each group should always be
Spaces, for now.  They are not used.  The reason they exist is so that
word-wise indexing can be used on the PDP-10 to access the syntax of a
character in an accumulator.

Indexentry:Edit Syntax Table,Altmode,C-],recursive editing level
  When you call Edit Syntax Table to edit the table, it will display
the syntax table broken up according to characters.  You will be able
to see easily what the syntax of any character is.  You are not
editing the table immediately, however.  Instead, you are asked for
the character whose syntax you wish to edit.  After typing it, you
will be positioned at that character's syntax group (of five
characters).  Overwrite Mode will be on, so you can just type the
desired syntax entries.  You can also do arbitrary editing, but be
careful not to change the position in the buffer of anything.  When
you exit the recursive editing level, you will be asked again for a
character whose syntax should be edited.  An Altmode at this point
will exit and make the changes.  A C-] at any time will abort the

Indexentry:major modes
  Many major modes alter the syntax table.  Each major mode creates
its own syntax table once and reselects the same string whenever the
mode is selected, in any buffer.  Thus, all buffers in Text mode at
any time use the same syntax table.  This is important because if you
ever change the syntax table of one buffer that is in text mode, you
will change them all.  It is possible to give one buffer a local copy
with a TECO program.{+Guide:@~}

	M.M Make Local Q-Register..D  :G..DU..D

The syntax tables belonging to the major modes are not preinitialized
in EMACS; they are created when the major mode is invoked for the
first time, by copying the default one and making specific changes.
Thus, any other changes you have made in the default (Fundamental
Mode) syntax table at the beginning will propagate into all modes'
syntax tables unless those modes specifically override them.

Indexentry:& Alter ..D,TECO
  TECO programs and init files can more easily use the function named
& Alter ..D (look at its documentation).  The syntax table is kept in
the q-register named ..D, which explains that name, and also the old
name of the Edit Syntax Table function, Edit ..D.

EMACS  Node: Init, Previous: Variables, Up: Top, Next: Libraries

Section:Init Files and EVARS Files
Indexentry:init files,EVARS files,customization

  EMACS is designed to be customizable; each user can rearrange things
to suit his taste.  Simple customizations are primarily of two types:
moving commands from one character to another, and setting variables
which many commands refer to so as to allow the user to select among
various options.  More complicated customizations can involve writing
entirely new commands and creating sharable libraries of them.

  The most general way to customize is to write an init file, a file
of TECO code which will be executed whenever you start EMACS.  This
file is found by looking for a particular filename, {+ITS:<homedir>;<uname>
EMACS}{+Twenex:<your directory>EMACS.INIT}.  This is general because an
arbitrary program can run, can ask you questions and do things, rather
than just setting up commands for later.  However, TECO code is
arcane, and only a few people learn how to write it.  If you need an
init file and don't feel up to learning to write TECO code, you should
ask a local expert to do it for you.{+INFO:  *Note Init: (EMACS;CONV), for
more about init files.{*Refill:}}

  However, simple customizations can be done in a simple way with an
EVARS file.  Such a file serves the same sort of purpose as an init
file, but instead of TECO code, it contains just a list of variables
and values.  Each line of the EVARS file names one variable or one
command character and says how to redefine it.  Blank lines are
allowed and ignored.  Your EVARS file is found by its filename, just
as an init file is, but it should be called {+ITS:EVARS instead of EMACS.}
{+Twenex:EMACS.VARS instead of EMACS.INIT.}  You can have
both an init file and an EVARS file if you want, as long as your init
file calls the default init file, since that is what processes the
EVARS file.{*Refill:}

  To set a variable, just include in the EVARS file a line containing
the name of the variable, a colon, and the value.  If you want a
string as a value, give the string; if you want a number as a value,
give the digits with an optional minus sign.  (If you happen to want a
value which is a string of all digits, you lose.)  Do NOT put Spaces
around the colon for visual effect.  Space before the colon will lose
completely, and space after the colon will simply be part of the value
of the variable.  Examples:

		Comment Column:70
		Comment Start:;
		Text Mode Hook:1M.LAuto Fill Mode

Indexentry:Auto Fill Mode
  Text Mode Hook, by the way, is supposed to hold a TECO program to be
executed whenever Text mode is entered, and the TECO program supplied
by this particular definition is designed to turn on Auto Fill Mode at
that time.  The effect would be that Auto Fill would always be on when
you were in Text mode.

Indexentry:redefining commands
  To redefine a command character is a little more complicated.
Instead of the name of a variable, give a  (control-R) followed by
the character.  Since the general Control and Meta character cannot be
part of a file, all Control and Meta characters are represented in  a
funny way:  after the  put the residue of the character after
removing the Control and Meta, and before the  put periods, one for
Control, two for Meta, and three for Control-Meta.  Thus, C-D is
represented by ".D" and C-M-; is represented by "...;".  Lower
case characters such as C-a are usually defined as "execute the
definition of the upper case equivalent".  Therefore, by redefining
the C-A command you also change C-a; but if you redefine C-a, by
saying ".a" instead of ".A", you will not change C-A.  So be careful.

  Instead of the value of a variable, for command character
redefinition you must give a TECO expression that returns the desired
definition.  This is to make it easy to use any function whose name you
know, because you can say M.MFOO as an expression that returns the
definition of the function FOO.  Example:{+Guide:@~}

		.K: M.M^R Kill Line

would give C-K the definition that it normally has.  Remember that
in names of functions the "^R" is actually a "^" and an R, not a
Control-R.  The space before the M.M does not hurt in this case
because it is ignored by TECO expression execution.

  Some non-printing characters are a little tricky to redefine.  For
example, you must know that Return, Linefeed, Tab, Backspace and
Altmode are not the same in TECO's command character set as C-M, C-J,
C-I, C-H and C-[, even though in ASCII they are synonymous.  By saying
.J you will redefine C-J; by saying  followed by a Linefeed (which
you must insert in the EVARS file by typing C-Q Linefeed) you can
redefine Linefeed.  Normally, C-J is defined as "execute the
definition of Linefeed", so you are better off redefining Linefeed.

Indexentry:C-X,prefix characters
  You can also redefine a subcommand of a prefix character such as
C-X.  For this, you have to know where the character's dispatch table
is stored.  For C-X, the location of the dispatch is called ".X"; you
won't have any other prefix characters unless you define them yourself.
{+INFO:*Note Prefix: (EMACS;CONV)Prefix.  }Knowing the location, you
specify the subcommand by writing :location(character).  This looks
silly, but it is a TECO expression with the right meaning.  For
example, redefining C-X C-S, the location is ".X" and the character is
, so we would say{+Guide:@~}

		:.X(): M.M^R Save File

This would give C-X C-S the definition that it normally has.  The
subcommand character ( in this case) can represent itself in the
EVARS file with no need for dots, because subcommand characters are
just ASCII, with no Meta allowed.

EMACS  Node: Libraries, Previous: Init, Up: Top, Next: Display

Chapter:Libraries of EMACS Commands.

  All EMACS functions, including the ones described in this document,
reside in sharable libraries.  A function is not accessible unless the
library that contains it is loaded.  Every EMACS starts out with one
library loaded: the EMACS library, which contains all of the functions
described in this document, except those explicitly stated to be
elsewhere.  Other libraries full of functions are provided with EMACS,
and can be loaded explicitly automatically or on request to make the
functions available.

Indexentry:loading,Load Library
  To load a library permanently, say M-X Load Library<libname><cr>.
The library will be found, either on your own directory or whichever
one you specify, or on the EMACS directory, and loaded in.  All the
functions in the library are then available for use.  Whenever you use
M-X, the function name you specify is looked up in each of the
libraries which you have loaded.  If any library contains a definition
for that name, the definition is executed.

  Thus, for example, if you load the PICTUR library, you can then use
M-X Edit Picture to run the Edit Picture function which exists in that

  In addition to putting functions in the search space for M-X, the
library may place some of them on commands.

indexentry:Run Library
  You can also load a library temporarily, just long enough to use one
of the functions in it.  This avoids taking up space permanently with
the library.  Do this with the function Run Library, as in M-X
Run<libname><function name><cr>.  The library <libname> will be
loaded in, and <function name> executed.  Then the library will be
removed from the EMACS job.  You can load it in again later.

indexentry:List Loaded Libraries,List Library
  M-X List Loaded Libraries types the names and brief descriptions of
all the libraries loaded, last loaded first.  You will see that the
last one is always the EMACS library.  You can get a description of
all the functions in a library with M-X List Library<libname>, whether
the library is loaded or not.

  Libraries are loaded automatically in the course of executing
certain functions.  You will not normally notice this.  For example,
the TAGS library is automatically loaded in whenever you use the M-.
or Visit Tag Table commands for the first time.  This process is known
as "autoloading".  It is used to make the functions in the TAGS
library available without the user's having to know to load the
library himself, while not taking up space in EMACS's of people who
aren't using them.  This works by simply calling Load Library on the
library known to be needed.  Another kind of "autoloading" loads a
library temporarily, the way Run Library does.  This is done when you
use the DIRED function, for example, since the DIRED library is not
needed after the DIRED function returns.  This works, not by calling
Run Library, but by doing M.A, which is how Run Library also works.

  You can make your own libraries, which you and other people can then
use, if you know how to write TECO code.{+INFO:  *Note Libs: (CONV)Lib,
for more details.}

EMACS  Node: Display, Previous: Libraries, Up: Top, Next: Windows

Chapter:Controlling the Display

	C-L	Clear and redisplay screen,
		 with point at specified place.
	C-V	Scroll upwards (a screen or a few lines).
	M-V	Scroll downwards.
	M-R	Move point to given vertical position.
	C-M-R	Get this function onto the screen

  A file is rarely short enough to fit on the screen of a terminal
all at once.  If the whole buffer doesn't fit on the screen, EMACS
shows a contiguous portion of it, containing the pointer.  It will
continue to show the same portion until the pointer moves outside of
it;  then EMACS will show a new portion centered around the new
pointer.  This is EMACS's guess as to what you are most interested in
seeing.  But if the guess is wrong, you can use the display control
commands to see a different portion.  The finite area of screen
through which you can see part of the buffer is called "the window",
and the choice of where in the buffer to start displaying is also
called "the window".

indexentry:C-L,minibuffer,TECO,clear screen
  The basic display control command is C-L (^R New Window).  In its
simplest form, with no argument, it tells EMACS to display a portion
of the buffer centered around where the pointer is currently located
(actually, the pointer goes 35% of the way down from the top;  this
percentage can be set by the user by executing <pct>FS % CENTER in a
minibuffer).  Normally, EMACS only recenters the pointer in the screen
when it moves past the edge. 

Indexentry:numeric arguments
  C-L with a positive argument chooses a new window so as to put point
that many lines from the top.  An argument of zero puts point on the
very top line.  The pointer does not move with respect to the text;
rather, the text and point move rigidly on the screen.  If you decide
you want to see more below the pointer this is the command to use.
C-L with a negative argument puts point that many lines from the
bottom of the window.  For example, C-U -1 C-L puts point on the
bottom line, and C-U -5 C-L puts it five lines from the bottom.

  If you want to see a few more lines at the bottom of the screen and
don't want to guess what argument to give to C-L, you can use the C-V
command.  C-V with an argument shows you that many more lines at the
bottom of the screen, moving the text and point up together as C-L
might.  C-V with a negative argument will show you more lines at the
top of the screen, as will Meta-V with a positive argument.

  Often you want to read a long file sequentially.  For this, the C-V
command without an argument is ideal; it takes the last two lines at
the bottom of the screen and puts them at the top, followed by a whole
screenful of lines not visible before.  The pointer is put after those
two lines.  Thus, each C-V shows the "next screenful", except for two
lines of overlap to provide continuity.  The variable QNext Screen
Context Lines, if defined, controls how many lines from the bottom of
the screen move to the top; the default if the variable is not defined
is 2.  To move backward, use M-V without an argument, which moves a
whole screenful backwards.

Indexentry:View File,View Buffer
  If @xxii[all] you want to do to a file is read it sequentially, you might
want to use M-X View File.  This command allows you to look at the
file a screenful at a time typing a Space to see the next screenful.
But you can't go backwards.  Typing anything but a Space exits the
command.  For in-between situations, M-X View Buffer might be useful.
It lets you move through the buffer a screenful at a time by typing
Spaces.  Typing a Return leaves you with point centered in whatever
part of the buffer was on the screen at the time.  Typing anything
else returns to the place where point was before you gave the View
Buffer command.

  To scroll the buffer so that the current function or paragraph is
positioned conveniently on the screen, use the C-M-R command (^R
Reposition Window).  This command tries to get as much as possible of
the current function or paragraph onto the screen, preferring the
beginning to the end, but not moving point off the screen.  A
"function" is delimited by blank lines except in Lisp mode, but
comments before the beginning are considered part of the function.

  C-L in all its forms changes the position of point on the screen,
carrying the text with it.  Another command moves point the same way
but leaves the text fixed.  It is called Meta-R (^R Move to Screen
Edge).  With no argument, it puts point at the center of the screen.
An argument is used to specify the line to put it on, counting from
the top if the argument is positive, or from the bottom if it is
negative.  Thus, Meta-0 Meta-R will put the cursor on the top line of
the screen.  Meta-R never causes any text to move on the screen; it
causes point to move with respect to the screen and the text.

EMACS  Node: Windows, Previous: Display, Up: Top, Next: Files

Chapter:Two Window Mode
Indexentry:windows,two window mode

	C-X 2		Start showing two windows.
	C-X 3		Show two windows but stay "in" the top one.
	C-X 1		Show only one window again.
	C-X O		Switch to the Other window
	C-X 4		Find buffer, file or tag in other window.
	C-X ^		Make this window bigger.
	C-M-V		Scroll the other window.

  Normally, EMACS is in "one-window mode", in which a single body of
text is visible on the screen and can be edited.  At times, one wants
to have parts of two different files visible at once.  For example,
while adding to a program a use of an unfamiliar feature, one might
wish to have the documentation of that feature visible.  "Two-window
mode" makes this possible.

Indexentry:W2,C-X 2
  The command C-X 2 (^R Two Windows) enters two-window mode.  A line
of dashes will appear across the middle of the screen, dividing the
text display area into two halves.  Window one, containing the same
text as previously occupied the whole screen, fills the top half,
while window two fills the bottom half.  The pointer will move to
window two.  If this is your first entry to two-window mode, window
two will contain a new buffer named W2.  Otherwise, it will contain
the same text it held the last time you looked at it.  The mode line
will now describe the buffer and file in window two.  Unfortunately,
it's almost impossible to provide a mode line for each window, so
making the mode line apply to the window you are in is the best we can

indexentry:C-X 1
  You can now edit in window two as you wish, while window one remains
visible.  If you are finished editing or looking at the text in the
window, C-X 1  (^R One Window) will return to one-window mode.  Window
one will expand to fill the whole screen, and window two will cease to
be visible until the next C-X 2.

indexentry:C-X O
  While you are in two window mode you can use C-X O (^R Other Window)
to switch between the windows.  After doing C-X 2 the cursor is in
window two.  Doing C-X O will move the cursor back to window one, to
exactly where it was before the C-X 2.  The difference between this
and doing C-X 1 is that C-X O leaves window two visible on the screen.
A second C-X O will move the cursor back into window two, just where
it was before the first C-X O.  And so on...

Indexentry:scrolling,numeric arguments,C-M-V
  Often you will be editing one window while using the other just for
reference.  Then, the command C-M-V (^R Scroll Other Window) is very
useful.  It scrolls the other window without switching to it and
switching back.  It scrolls just the way C-V does:  with no arg, a
whole screen up;  with an argument, that many lines up (or down, for a
negative argument).  With just a minus sign (no digits) as an
argument, C-M-V scrolls a whole screenful backwards, like an M-V.

  When you are finished using two windows, the C-X 1 command will make
window two vanish.  It doesn't matter which window the cursor is in
when you do the C-X 1;  either way window two vanishes and window one
remains.  To make window one vanish and window two remain, give C-X 1
an argument.

indexentry:C-X 3
  The C-X 3 command is like C-X 2 but leaves the cursor in window one.
That is, it makes window two appear at the bottom of the screen but
leaves the cursor where it was.  C-X 2 is equivalent to C-X 3 C-X O.
C-X 3 is equivalent to C-X 2 C-X O, but C-X 3 is much faster.

indexentry:C-X ^
  Normally, the screen is divided evenly between the two windows.
You can also redistribute the lines between the windows with the C-X ^
(^R Grow Window) command.  It makes the currently selected window get
one line bigger, or as many lines as is specified.  If given a
negative argument, the selected window gets smaller.  The allocation
of space to the windows is always remembered and changes only when you
give a C-X ^ command.

Indexentry:numeric arguments,buffers
  You can view the same buffer in both windows.  Give C-X 2 an
argument as in C-U C-X 2 and you will go into window two viewing the
same buffer as in window one.  Although the same buffer appears in
both windows, they have different cursors, so you can move around in
window two while window one continues to show the same text.  Then,
having found in window two the place you wish to refer to, you can go
back to window one with C-X O to make your changes.  Finally you can
do C-X 1 to make window two leave the screen.  However, if you have
the same buffer in both windows this way, you must watch out against
trying to visit a different file in one of the windows with C-X C-V,
because if you bring a new file into this buffer, it will replace the
old one in @xxii[both] windows.  To view different files in the two windows
again, you must switch buffers in one of the windows first.

  Buffers can be selected independently in each window.  The C-X B
command selects a new buffer in whichever window the cursor is in.
The other window's buffer does not change.  When you do C-X 2 and
window two appears it will show whatever buffer used to be visible in
it when it was on the screen last.  C-U C-X 2 makes window two select
whichever buffer was selected in window one.

indexentry:C-X 4,visiting,files,tags
  A convenient "combination" command for viewing anything interesting
in the other window is C-X 4.  With this command you can ask to see
any specified buffer, file or tag in the other window.  Follow the
C-X 4 with either B and a buffer name, F or C-F and a file name, or T
or "." and a tag name.  This will switch to the other window and
there find what you specified.  If you were previously in one-window
mode, two-window mode will be entered.

  While in one-window mode, you can still use C-X O, but the effect is
slightly different.  Window two does not appear, but whatever was
being shown in it appears, in window one (the whole screen).  Whatever
buffer used to be in window one is stuck, invisibly, into window two.
Another C-X O will reverse the effect of the first.  For example, if
window one shows buffer B and window two shows buffer W2 (the usual
case), and only window one is visible, then after a C-X O window one
will show buffer W2 and window two will show buffer B.

EMACS  Node: Files, Previous: Windows, Up: Top, Next: Search

Chapter:File Handling

  The basic unit of stored data is the file.  Each program, each
paper, lives usually in its own file.  To edit a program or paper, the
editor must be told the name of the file that contains it.  This is
called "visiting" the file.  To make your changes to the file
permanent on disk, you must "save" the file.  EMACS also has
facilities for deleting files conveniently, and for listing your
directory.  Special text in the file can specify the modes that should
be used when editing the file.
* Menu:

* Visiting::	How to select a file for editing
* Revert::	How to cancel some changes you have made
* Buffers::	Using multiple buffers;  visiting several files at once
* Locals::	The file can say what editing modes are right for it
* AutoSave::	Protection from crashes
* CleanDir::	Deleting old versions to clean up
* DIRED::	selectively deleting files (Directory Editor)
* Filadv::	advanced file commands
{+ITS:* DirComp::	directory comparison
EMACS  Node: Visiting, Previous: Files, Up: Files, Next: Revert

Section:Visiting Files

  The basic unit of stored data is the file.  Each program, each
paper, lives usually in its own file.  To edit a program or paper, the
editor must be told the name of the file that contains it.  This is
called "visiting" the file.  You can only edit a file when you are
visiting it.  Unless you use the multiple buffer and window features
of EMACS, you can only be visiting one file at a time.  The name of
the file you are visiting in the currently selected buffer is visible
in the mode line when you are at top level, unless you aren't visiting
any file.

  The changes you make to a file you are visiting are not actually
made in the file itself, however, but in a copy inside the EMACS.  The
file itself is not changed, and the editing is not permanent, until
the file is "saved".  You can save the file at any time by command.
EMACS will normally save the file whenever you switch files,
so you don't have to worry about forgetting to save before reading in
another file over your edited text.  In addition, for those who are
afraid of system crashes, "Auto Save" mode is available.  It performs
a save at regular intervals automatically.{+INFO:  *Note Save: AutoSave.}

indexentry:C-X C-V,C-G,C-U,Return
  To visit a file, use the command C-X C-V (^R Visit File).  Follow
the command with the name of the file you wish to visit, terminated by
a carriage return.  If you can see a filename in the mode line, then
that name is the default, and any component of the filename which you
don't specify will be taken from it.  If you can't see a filename in
the mode line (because you are on a printing terminal, or because you
hadn't visited any file yet), EMACS will print what the defaults are.
You can abort the command by typing C-G, or cancel your type-in for
the filename with C-U.  If you do type a Return to finish the command,
the new file will appear on the screen, and its name will show up in
the mode line.

indexentry:C-X C-S
  When you wish to save the file and make your changes permanent, type
C-X C-S (^R Save File).  After the save is finished, C-X C-S will
print "Written: <filenames>" in the echo area at the bottom of the
screen.  {+ITS:If you are visiting a file whose name is ">", this message
will say what version number was actually written.  }EMACS won't
actually write out the file if the contents have not been changed
since the last save or since the file was read in.  So you don't have
to try to remember that yourself;  when in doubt, type a C-X C-S.
If you really can't remember what changes you made in the buffer,
write it out as a new version and then SRCCOM it against the
previous.  If you didn't make any changes you want to keep, you can
then delete the new version.{*Refill:}

  If you alter one file and then visit another, EMACS may offer to
save the old one.  If you answer Y, the old file will be saved; if you
answer N, all the changes you have made to it since the last save will
be lost.  You should not type ahead after a file visiting command,
because your type-ahead might answer an unexpected question in a way
that you will regret.  If you are sure you only want to look at a
file, and not change it, you can use the C-X C-R command to visit it,
instead of C-X C-V.  Then EMACS will not offer to save the file when
you later visit another, since it will assume the changes were inadvertent.
However, you can still save the file with C-X C-S if you want.

  If EMACS is about to save a file automatically and discovers that
the text is now a lot shorter than it used to be, it will tell you so
and ask for confirmation ("Y" or "N").  If you aren't sure what to
answer (because you are surprised that it has shrunk), type C-G to
abort everything, and take a look around.

  If EMACS is about to save a file and sees that the latest version on
disk is not the same one as EMACS last read or wrote, you will be
told, and asked what to do.  This is because someone else may be
editing the same file, and either you or he will probably lose all the

  What if you want to create a file?  Just visit it.  If you save the
"changes", the file will be created.  If you visit a nonexistent file
unintentionally (because you typed the wrong file name), just switch
to the file you meant.  If you didn't "change" the nonexistent file
(ie, you left it empty the way you found it) no file will be created.

Indexentry:file directory,List Files,C-X C-D,numeric arguments,string arguments
  To look at a part of a file directory, use the C-X C-D command
(^R Directory Display).  With no argument, it shows you the file you
are visiting, and related files.  C-U C-X C-D reads a filespec from
the terminal and shows you the directory based containing that
filespec.  To see the whole directory in a brief format, use the
function List Files, which takes the directory name as a string

EMACS  Node: Revert, Previous: Visiting, Up: Files, Next: Buffers

Section:How to Undo Drastic Changes to a File
Indexentry:Undo,Revert File,files

indexentry:numeric arguments
  In this situation you might want to use M-X Revert File, which will
read in the last saved version of the file.  If you have been using
Auto Save mode, it will read in the last version of the file or the
last auto save file, whichever is more recent.  If you want only the
last "real" save, ignoring auto saves, you can use a numeric argument
of 1.

  M-X Revert File does not change point, so that if the file was only
edited slightly, you will be at approximately the same piece of text
after the Revert as before.  If you have made drastic changes, the
same value of point in the old file may address a totally different
piece of text.

  Because M-X Revert File can be a disaster if done by mistake, it
asks for confirmation (Y or N) before doing its work.  A pre-comma
argument can be used to inhibit the request for confirmation when you
call the function Revert File from a program, as in 1,M(M.M

EMACS  Node: Buffers, Previous: Revert, Up: Files, Next: Locals

Section:Buffers: How to Switch between Several Bodies of Text

  When talking of "the buffer", which contains the text you are
editing, I have given the impression that there is only one.  In fact,
there may be many of them, each with its own body of text.  At any
time only one buffer can be "selected" and available for editing,
but it isn't hard to switch to a different one.  Each buffer
individually remembers which file it is visiting, what modes are in
effect, and whether there are any changes that need saving.

indexentry:mode line
  Each buffer in EMACS has a single name, which normally doesn't
change.  A buffer's name can be any length, and can't conflict with
any other kind of name.  The name of the currently selected buffer is
visible in the mode line when you are at top level.  A newly started
EMACS has only one buffer, named "Main".

Indexentry:C-X B,Select Buffer
  To create a new buffer, you need only choose a name for it (say,
"FOO") and then do C-X B FOO<cr>, which is the command C-X B (Select
Buffer) followed by the name.  This will make a new, empty buffer and
select it for editing.  The buffer will start out in all the same
modes as the one you were using before, but you can change each
buffer's major mode independently.  A new buffer is not visiting any
file, so if you try to save it you will be asked for the filenames to

  To return to buffer FOO later after having switched to another, the
same command - C-X B FOO<cr> - is used, since C-X B can tell whether a
buffer named FOO exists already or not.  C-X B Main<cr> reselects the
buffer Main that EMACS started out with.  Just C-X B<cr> reselects the
previous buffer.  Repeated C-X B<cr>'s will alternate between two

Indexentry:C-X C-F,visiting
  You can also read a file into its own newly created buffer, all with
one command:  C-X C-F, followed by the filename.  C-F stands for
"Find", because if the specified file already resides in a buffer in
your EMACS, that buffer will be reselected.  So you need not remember
whether you have brought the file in already or not.  A buffer created
by C-X C-F can be reselected later with C-X B or C-X C-F, whichever
you find more convenient.  Nonexistent files can be created with
C-X C-F just as they can be by visiting them in an existing buffer.

  If the buffer with the name C-X C-F wants to use already exists but
with the wrong contents (a different file with a similar name, or no
file), then you are asked what to do.  You can type Return meaning go
ahead and use the buffer for this new file, or you can type another
name to use for the buffer instead of the normal one.  If C-X C-F does
find the file already in a buffer, then it checks to see whether the
version on disk is the same as the last version read or written from
that buffer.

Indexentry:C-X C-B,List Buffers
  To get a list of all the buffers that exist, do C-X C-B or do
M-X List Buffers.  Each buffer's name, major mode, and visited
filenames will be printed.  A star at the beginning of a line
indicates a buffer which contains changes that have not been saved.
The number that appears before a buffer's name in a C-X C-B listing
is that buffer's "buffer number".  You can select a buffer by giving
its number as a numeric argument to C-X B, which then will not need to
read a string from the terminal.

Indexentry:Save All Files,C-X C-S
  If several buffers have stars, you should save some of them by
doing M-X Save All Files.  This will find all the buffers that need
saving and ask about each one individually.  Saving the buffers this
way is much easier and more efficient than selecting each one and
typing C-X C-S.

indexentry:Kill Buffer,Kill Some Buffers,C-X K,recursive editing level
  After using an EMACS for a while, it may fill up with buffers
holding files that you no longer need to edit.  If you have enough of
them, you can reach a point where you can't read in any more files.
So whenever it is convenient you should do M-X Kill Some Buffers,
which will ask about each buffer individually.  You can say Y or N to
kill it or not.  Or you can say Control-R to take a look at it first.
This does not actually select the buffer, as the mode line will show,
but gives you a recursive editing level in which you can move around
and look at things.  When you have seen enough to make up your mind,
exit the recursive editing level with a C-C C-C and you will be asked
the question again.  If you say to kill a buffer that needs saving,
you will be asked whether to save it.

  You can kill the buffer FOO by doing C-X K FOO<cr>.  You can kill
the current buffer, a common thing to do if you use C-X C-F, by doing
C-X K<cr>.  If you kill the current buffer, in any way, EMACS will ask
you which buffer to select instead.  Saying just <cr> at that point
will ask EMACS to choose one reasonably.  C-X K runs the function Kill

indexentry:local variables,List Locals,TECO
  As well as the visited file and the major mode, a buffer can,
if ordered to, remember many other things "locally" - independently of
all other buffers.  Any TECO Variable can be made local to a specific
buffer by doing M.L<variable name>.  Thus, if you want the comment
column to be column 50 in one buffer, whereas you usually like 40,
then in the one buffer you should do M.LComment Column.  Then, you
can do 50UComment Column in that buffer and all other buffers will
not be affected.  To get a list of the local variables in the current
buffer, do M-X List Locals.  Note that every buffer has a few local
variables made automatically for internal use.  The Local Modes
feature makes use of these local variables, which are created when you
visit the file and destroyed (made no longer local) when you visit
some other file in the buffer.{+INFO:  *Note Locals: Locals.  For information
on how local variables work, and additional related features, see
*Note Details: (EMACS;CONV)Variables.}

Indexentry:Rename Buffer
  M-X Rename Buffer<new name><cr> changes the name of the currently
selected buffer.  If <new name> is the null string, the first filename
of the visited file is the used for the new name of the buffer.

EMACS  Node: Locals,  Previous: Buffers,  Up: Files,  Next: AutoSave

Section:Local Variables in Files
indexentry:local variables,files,major modes,Auto Fill Mode
indexentry:redefining commands,customization,buffers

  By putting "local mode specifications" in a file you can cause
certain major or minor modes to be set, or certain character commands
to be defined, whenever you are visiting it.  For example, EMACS can
select LISP Mode for that file, or it can turn on Auto Fill Mode, set
up a special Comment Column, or put a special command on the character
C-M-,.  Local modes can specify the major mode, and the values of any
set of named variables and command characters.  Local modes apply
only while the buffer containing the file is selected;  they do not
extend to other files loaded into other buffers.
  Often, EMACS will be able to determine the best major mode for a
file by looking at the file's extension.  If this works, you won't
need to worry about specifying the major mode.  If the extension of
the file does not inform EMACS correctly, then you will need an
explicit local modes specification.
  The simplest kind of local mode specification sets only the major
mode.  You put the desired mode's name in between a pair of "-*-"'s,
anywhere on the first nonblank line of the file.  For example, if this
line were the first nonblank line of this file, -*-Text-*- would enter
Text Mode.{+INFO:  In fact, a -*-Text-*- appears at the front of this file,
but you won't normally see it since it is before the start of the
first node.}{+Twenex:  The -*- can appear on the first nonblank line
after the edit history, if somebody insists on putting in an edit

Indexentry:EVARS files,C-X,prefix characters
  To specify more that just the major mode, you must use a "local
modes" list, which goes in the LAST page of the file (it is best to
put it on a separate page).  The local modes list starts with a line
containing the string "Local Modes:".  Whatever precedes that string
on the line is the "prefix", and whatever follows it is the "suffix"
(either or both may be null).  From then on, each line should start
with the prefix, end with the suffix, and in between contain one local
mode specification in the form <varname>:<value>.  To set a variable,
make <varname> the name of the variable and <value> the desired value.
If <value> is a numeral (which means no spaces!), the value will be a
number;  otherwise, it will be <value> as a string.  To set a
command character, make <varname> the name of the character as a
q-register, such as ..., for C-M-Comma, and make <value> be a string
of TECO commands which will return the desired value (this is so you
can write M.MFoo to define the character to run the function Foo).
The local modes list is terminated by a line which contains "End:"
instead of <varname>:<value>.  Aside from the "Local Modes:" and the
"End:", and the prefix and suffix if any, a local modes list looks
just like an EVARS file.  However, comments lines are not allowed, and
you cannot redefine C-X subcommands due to fundamental limitations of
the data structure used to remember local variables.  Sorry.{+INFO:
*Note EVARS: Init, for more information.}

  The major mode can be set by specifying a value for the variable
"Mode" (don't try setting the major mode this way except in a local
modes list!).  A function M-X Foo can be defined locally by putting in
a local setting for the variable named "MM Foo".

Indexentry:Comment Column,Comment Start
  Here is an example of a local modes list:

	;;; Local Modes: :::
	;;; Comment Column:0 :::
	;;; Comment Start:;;;  :::
	;;; ../: m.m^R My Funny Meta-Slash :::
	;;; Mode:LISP :::
	;;; End: :::

  Note that the prefix is ";;; " and the suffix is " :::".  Note also
that the value specified for the Comment Start variable is ";;; ",
which is the same as the prefix (convenient, eh?).

  If you have a local modes list, the last page of the file must be no
more than 10000 characters long or it will not be recognized.  This is
because EMACS finds the local modes list by scanning back only 10000
characters from the end of the file for the last ^L, and then looking
forward for the "Local Modes:" string.  This accomplishes these goals:
a stray "Local Modes" not in the last page is not noticed;  and
visiting a long file that is all one page and has no local mode list
need not take the time to search the whole file.

EMACS  Node: AutoSave,  Previous: Locals,  Up: Files,  Next: CleanDir

Section:Auto Save Mode -- Protection Against Crashes
Indexentry:files,visiting,saving,Auto Save Mode

  If you turn on Auto Save Mode, EMACS will save your file from time
to time (based on counting your commands) without being asked.  Your
file will also be saved if you stop typing for more than a few minutes
when there are changes in the buffer.  This prevents you from losing
more than a limited amount of work when the system crashes.

Indexentry:Auto Save Default
  You can turn auto saving on or off in an individual buffer with M-X
Auto Save.  In addition, you can specify whether to do auto saving by
default in all buffers by setting QAuto Save Default.  The frequency
of saving, and the number of saved versions to keep, can both be

Indexentry:numeric arguments
  Each time you visit a file, no matter how, auto saving will be on
for that file if QAuto Save Default is nonzero.  However, by giving
a nonzero argument to the file-visiting command, you can turn off auto
saving @xxii[for that file only], without changing the default.  Once you
have visited a file, you can turn auto saving on or off with M-X Auto
Save.  Like other minor mode commands, M-X Auto Save turns the mode on
with a positive argument, off with a zero or negative argument; with
no argument, it turns saving on if it was off, and vice versa.  If you
start typing a new file into a buffer without visiting anything, auto
save mode will initially be off, but you can turn it on with M-X Auto

  When an auto save happens, "(Auto Save)" will be printed in the echo
area.  On a printing terminal, nothing is printed because printing
would interfere with your editing, but the bell is rung instead.  An
error will print "(Auto Save Error!)".

  Let us suppose that it is time for an automatic save to be done:
where should the file be saved?

  Two workable methods have been developed:  save the file under the
names you have visited, or save it under some special "auto save file
name".  Each solution has its good and bad points.  The first one is
excellent some of the time, but intolerable the rest of the time.  The
second is usually acceptable.  Auto saving under the visited file's
actual names means that you need do nothing special to gobble the auto
save file when you need it;  and it means that there is no need to
worry about interference between two users sharing a directory, as
long as they aren't screwing up by editing the same file at once.
However, this method can have problems:{+Guide:@~}

  If you visit a file on a device other than DSK, auto saves can't
    go there, because it would probably be slow.
  If your file does not have a numeric version number, or you have
    visited a fixed version, auto saves can't go under that name,
    because they would clobber the original file.

  If you visit a file with C-X C-R, then you have said you don't want
    to store under those names.

  If you haven't visited a file, there aren't any names to use.

Indexentry:Auto Save Filenames,Auto Save Visited File
So in all those cases, auto saves are written as the filenames in
QAuto Save Filenames.  But if none of those cases apply -- if your
visited file has version numbers, and can be written quickly -- then
it is possible to store auto saves under that name.  This will be
done, provided that you turn on the feature by setting the variable
Auto Save Visited File to a nonzero value.

indexentry:C-X C-S
  When you want to save your file "for real", use C-X C-S, as always.
C-U C-X C-S is a way to request an "auto" save explicitly.  When you
are auto saving under the visited filenames, there is not much
difference between an auto save and a "real" save, except that an auto
save will eventually be deleted automatically by EMACS a few auto
saves later, while a "real" save will be left around forever (at
least, auto save won't delete it).

Indexentry:C-X C-W,Revert File
  When it is time to recover from a system crash by reloading the auto
save file, if auto saving was using the visited file names you have
nothing special to do.  If auto saving was using special auto save
filenames, you should read in the last auto save file and then use C-X
C-W to write it out in its real location.  If you want to use an auto
save file to throw away changes that you don't like, you can use M-X
Revert File, which knows how to find the most recent save, permanent or not,
under whatever filenames.{+INFO:  *Note Revert: Revert.}

  For your protection, if a file has shrunk by more than 30% since the
last save, auto saving will not save.  It will type out instead that
the file has shrunk.  You can save explicitly if you wish; after that,
auto saving will resume.

Indexentry:Auto Save Max
  Although auto saving will generate large numbers of files, it will
not clog directories, because it cleans up after itself.  Only the
last QAuto Save Max auto save files are kept; as further saves are
done, old auto saves are deleted.  However, files which were not made
by auto saves (or by explicitly requested auto-saves with C-U C-X C-S)
are never deleted in this way.  The variable QAuto Save Max is
initially 2.  Changing the value may not take effect in a given buffer
until you turn auto saving off and on in that buffer.

indexentry:Auto Save Interval
  The number of characters of input between auto saves is controlled
by the variable QAuto Save Interval.  It is initially 500.  Changing
this takes effect immediately.

Indexentry:Buffer Creation Hook
  QAuto Save Filenames is usually set up by the default init file to
{+ITS:DSK:<msname>;_^RSV >}{+Twenex:<your directory>_^RSV..}.  Or, if
you use auto saving in multiple buffers a lot, you might want to have
a Buffer Creation Hook which sets Auto Save Filenames to a filename
based on the buffer name, so that different buffers don't interfere
with each other.{*Refill:}

EMACS  Node: CleanDir,  Previous: AutoSave,  Up: Files,  Next: DIRED

Section:Cleaning a File Directory
Indexentry:file deletion,directory

  The normal course of editing constantly creates new versions of
files.  If you don't eventually delete the old versions, the directory
will fill up and further editing will be impossible.  EMACS has
commands that make it easy to delete the old versions.

  For complete flexibility to delete precisely the files you want to
delete, you can use the DIRED package.{+INFO: (*Note DIRED: DIRED, for more

  But there is a more convenient way to do the usual thing:  keep only
the two (or other number) most recent versions.

Indexentry:Reap File,Temp File FN2 List
  M-X Reap File<file><cr> counts the number of versions of <file>.  If
there are more than two, you are told the names of the recent ones (to
be kept) and the names of the older ones (to be deleted), and asked
whether to do the deletion (answer "Y" or "N").  In addition, if there
is a file with an FN2 of MEMO, @@XGP, XGP or UNFASL, you are asked
whether it too should be deleted (this is actually controlled by a
TECO search string in QTemp File FN2 List).

  If you give M-X Reap File a null argument, or no argument, then it
will apply to the file you are visiting.

Indexentry:Clean Directory,File Versions Kept
  M-X Clean Directory<dirname>{+ITS:;} <cr> cleans a whole directory
of old versions.  Each file in the directory is processed a la M-X
Reap File.  M-X Clean Dir with a null argument, or no argument, cleans
the directory containing the file you are visiting.

  M-X Reap File and M-X Clean Dir can be given a numeric argument
which specifies how many versions to keep (instead of two).  For
example, C-U 4 M-X Reap File would keep the four most recent versions.
The default when there is no argument is the value of QFile Versions
Kept, which is initially 2.

EMACS  Node: DIRED,  Previous: CleanDir,  Up: Files,  Next: Filadv

Section:DIRED, the Directory Editor Subsystem
Indexentry:DIRED,file deletion

  DIRED makes it easy to delete many of the files in a single
directory at once.  It presents a copy of a listing of the directory,
which you can move around in, marking files for deletion.  When you
are satisfied, you can tell DIRED to go ahead and delete the marked

Indexentry:recursive editing level,C-M-C,C-]
  Invoke DIRED with M-X DIRED to edit the current default directory,
or M-X DIRED<dir>{+ITS:;}<cr> to edit directory <dir>.  You will then
be given a listing of the directory which you can move around in with
all the normal EMACS motion commands.  Some EMACS commands are made
illegal and others do special things, but it's still a recursive
editing level which you can exit normally with C-C C-C and abort with

  You can mark a file for deletion by moving to the line describing the
file and typing D, C-D, K, or C-K.  The deletion mark is
visible as a D at the beginning of the line.  Point is moved to the
beginning of the next line, so that several D's will delete several
files.  Alternatively, if you give D an argument it will mark that
many consecutive files.  Given a negative argument, it will mark the
preceding file (or several files) and put point at the first (in the
buffer) line marked.  Most of the DIRED commands (D, U,{+ITS: !, $, P, S, C,}
E, space) repeat this way with numeric arguments.

  If you wish to remove a deletion mark, use the U (for Undelete)
command, which is invoked just like D:  it removes the deletion mark
from the current line (or next few lines).  However, if the current
line has no D on it, and the previous line does have a D, U removes
that deletion mark and moves upward.  This allows you to undo a D with
just a U.

  For extra convenience, Space is made a command similar to C-N.
Moving down a line is done so often in DIRED that it deserves to be
easy to type.

  If you are not sure whether you want to delete a file, you can
examine it by typing E.  This will enter a recursive editing mode on
the file, which you can exit with C-C C-C.  The file is not really
visited at that time, and you are not allowed to change it.  After you
exit the recursive editing level, you will be back in DIRED.

  When you have marked the files you wish to mark, you can exit DIRED
by typing X, Q, or Control-Altmode.  If there were any files
marked, DIRED will then list them in a concise format, several per
line.  {+ITS:A file with "!" appearing next to it in this list has not been
saved on tape and will be gone forever if deleted.  A file with ">" in
front of it is the most recent version of a sequence and you should be
wary of deleting it.  }Then DIRED asks for confirmation of the list. 
You can type "YES" (Just "Y" won't do) to go ahead and delete them,
"N" to return to editing the directory so you can change the marks, or
"X" to give up and delete nothing.  Anything else typed will make
DIRED print a list of these responses and try again to read one.

  A few other DIRED commands are provided.

{+ITS:  The "!" command moves down (or up, with an argument of -1) to the
next undumped file (one with a "!" before its date). 
  N finds the next "hog" - the next file which has at least three

{+ITS:  T when given on a line describing a link marks for deletion the
file which the link points to.  This file need not be in the directory
you are editing to be deleted in this way. 

  S copies the file you are pointing at to the secondary pack.

  P copies the file you are pointing at to the primary pack.

  $ complements the don't-reap attribute of the file; this is
displayed as a dollar sign to the left of the file date.

  C valrets a :SRCCOM command to DDT.  You must confirm it with
carriage return before it will be executed; this allows you to
add SRCCOM switches to the command line.
  H helps you clean up.  It marks "old" versions of the current file,
and versions with "temporary" second file names, for deletion.  You can
then use the D and U commands to edit these marks if they are not exactly
right.  The variables QFile Versions Kept and QTemp File FN2 List
control which files H picks for deletion.  With an argument (C-U H),
it does the whole directory instead of just the current file.

  ? displays a list of the DIRED commands.

Indexentry:C-X D,directory
  There are some other ways to invoke DIRED.  The Emacs command C-X D
puts you in DIRED on the directory containing the file you are currently
editing.  With a numeric argument of 1 (C-U 1 C-X D),
only the current file is displayed instead of the whole directory.
In combination with the H command this can be useful for cleaning up
excess versions of a file after a heavy editing session.  With a numeric
argument of 4 (C-U C-X D), it will ask you "Directory;".  Type a directory
name {+ITS:followed by a semicolon, }and/or a file name.  If you explicitly
specify a file name only versions of that file are displayed, otherwise
the whole directory is displayed.

indexentry:Keep Lines
  It is unwise to try to edit the text of the directory listing
yourself, without using the special DIRED commands, unless you know
what you are doing, since you can confuse DIRED that way.  To make it
less likely that you will do so accidentally, the self-inserting
characters are all made illegal inside DIRED.  However, deleting whole
lines at a time is certainly safe.  This does not delete the files
described by those lines; instead, it makes DIRED forget that they are
there and thus makes sure they will @xxii[not] be deleted.  Thus, M-X Keep
Lines is useful if you wish to delete only files with a FOO in their
names.{+INFO: *Note Keep Lines: Replace.}

  For more complicated things, you can use the minibuffer.  When you
call the minibuffer from within DIRED, you get a perfectly normal one.
The special DIRED commands are not present while you are editing in
the minibuffer.  To mark a file for deletion, replace the space at the
beginning of its line with a "D".  To remove a mark, replace the "D"
with a Space.

EMACS  Node: Filadv,  Previous: DIRED,  Up: Files{+ITS:,  Next: DirComp}

Section:Miscellaneous File Operations
Indexentry:insertion,files,Insert File,Write File,Append to File,Prepend to File

  M-X Insert File <file> <cr> inserts the contents of <file> into the
buffer at point, leaving point unchanged before the contents and mark
after them.  The current defaults are used for <file>, and are updated.

  M-X Write Region <file> <cr> writes the region (the text between
point and mark) to the specified file.  It does not set the visited
filenames.  The buffer is not changed.

  M-X Append to File <file> <cr> appends the region to <file>.  The text
is added to the end of <file>.

  M-X Prepend to File <file> <cr> adds the text to the beginning of
<file> instead of the end.

Indexentry:Set Visited Filename,List Files,Delete File,Copy File,Rename File
  M-X Set Visited Filename<file><cr> changes the name of the file
being visited without reading or writing the data in the buffer.  M-X
Write File is equivalent to this command followed by a C-X C-S.

  M-X List Files<dir spec><cr> lists just the names of all the files
in <dir>, several to a line.

  M-X Delete File<file><cr> deletes the file.

  M-X Copy File<old file><new file><cr> copies the file.

  M-X Rename File<old name><new name><cr> renames the file.

Indexentry:TECO,TECO default filenames
  The default filenames for all of these operations are the "TECO
default filenames".  Most of these operations also leave the TECO
default names set to the file they operated on.   The TECO default is
@xxii[not always] the same as the file you are visiting.  When you visit a
file, they start out the same, but the commands mentioned above can
change the TECO default, thought they certainly don't change the
visited filenames (so C-X C-S knows where to save your file).  Each
buffer has its own TECO default filenames.

Indexentry:C-X C-W,C-X C-V
  At times you want to "Change the name" of a file you are editing.
The command C-X C-W (Write File) allows you to save the buffer into a
specified file, which then becomes the file you are visiting.  It
takes its arguments and handles the defaults just like C-X C-V.  In
fact, it is equivalent to writing the buffer out to the file and then
visiting that file.  You can also use the function Set Visited Filename
described above.

Indexentry:Visit File
  The operation of visiting a file is available as a function
under the name M-X Visit File<file>.  In this form, it uses
the TECO default as its defaults, though it still sets both the TECO
default and the visited filenames.

Indexentry:Auto Directory Display,Directory Lister
  The variable QAuto Directory Display can be set to make many file
operations display the directory automatically.  The variable is
normally 0;  making it positive causes write operations such as M-X
Write File to display the directory, and making it negative causes
reads (M-X Visit File) to display it as well.  The display is done using
the default directory listing macro which is kept in
QDirectory Lister.  Normally, in EMACS, this is the macro that
displays only the files related to the current default file.
Indexentry:Strip SOS Line Numbers
  The function Strip SOS Line Numbers will remove all line numbers
from the current buffer. Actually, what it does is reset the low
order bit in each word and remove all nulls. An explicit argument
will inhibit removal of nulls unless the file actually has line numbers.}
EMACS  Node: DirComp,  Previous: Filadv,  Up: Files

Section:The Directory Comparison Subsystem
Indexentry:directory,Compare Directories

  The function Compare Directories makes it easy to compare two
directories to see which files are present in both and which are
present only in one.  It compares a directory on the local machine
with the directory of the same name on another machine.

  Do M-X Compare Directories<machine>:<dir spec> <switch>, where
<machine> is AI, ML, MC or DM, and is not the machine you are on,
<dir spec> is an optional sname and semicolon, and the optional switch
is a slash followed by S, D or L.

  After a while of crunching, you will be placed in a recursive
editing level on a listing of both directories.  The reason for the
recursive editing level is simply to make it easy for you to view the
comparison; unlike DIRED, Compare Directories does not have any
commands for moving or deleting the files.  To exit, do C-C C-C.

  Here is a sample of part of a directory comparison:
AI   RMS    #1=72 #2=78 #3=71 #4=77 #5=87 - 
MC   RMS    #0=231 #1=254 #13=2844 
AI MC     .DDT.  (INIT)    1   11/18/76 01:08   10/21/76 05:06
AI        AR2    1        16   2/6/77   17:51
AI        AR3    1        13   2/17/77  21:37
   MC     FTPU   4         9                   !3/4/77   16:46
   MC     FTPU   5         9                   !3/4/77   16:49
AI MC     MATCH  1        15  !3/4/77   15:39  !3/4/77   15:39
  It begins with one line for each of the two directories, these lines
say which two directories they are, and how much disk space is
available on each of the machines.

  Then there comes the list of files, one line for each distinct pair
of filenames that appears.  At the beginning of the line appear the
names of the machines on which the file exists.  At the end of the
line come the creation dates (or names pointed at, for links) of the
file for the machines it is on.  Note that all the dates/link names
for the first machine line up, and so do all those for the second

  The switches allow you to view only some of the files.  The /S
switch shows only files present on both machines.  /D shows only those
not present on both machines.  /L shows only files which are the most
recent (largest-numbered) of a sequence.  Only one switch is allowed.
EMACS  Node: Search, Previous: Files, Up: Top, Next: Fixit


  Searching moves the cursor to the next occurrence of a string of
characters which you specify.  In EMACS, searching is "incremental",
which means that as you type in the search string EMACS shows you
where it would be found.  When you have typed enough characters to
identify the place you want, you can stop.

  EMACS also has commands to find all or some occurrences of a string
and replace them, print them, or count them.
{+INFO:* Menu:
* Replace::	Look here for several useful replacement commands.
  The command to search is C-S (^R Incremental Search).  C-S reads in
characters and positions the cursor at the first occurrence of the
characters that you have typed.  If you type C-S and then F, the
cursor will move to right after the next "F".  Type an "O", and see
the cursor move to after the next "FO".  Type another "O", and the
cursor will be after the first "FOO" after the place where you started
the search.  At the same time, the "FOO" has echoed at the bottom of
the screen.

  If you type a mistaken character, you can rub it out.  After the
FOO, typing a rubout will make the "O" disappear from the bottom of
the screen, leaving only "FO".  The cursor will move back to the "FO".
Rubbing out the "O" and "F" will move the cursor back to where you
started the search.

  When you are satisfied with the place you have reached, you can type
an Altmode, which will stop searching, leaving the cursor where the
search brought it.  Any command except a printing character or CR will
stop the searching and then be executed.  Thus, if you find the word
FOO you can type Meta-Rubout to exit the search and kill the FOO.
Altmode is necessary only if the next thing you want to do is insert
text, or rub out, since those things are special while searching.

  Sometimes you search for "FOO" and find it, but not the one you
expected to find.  There was a second FOO that you forgot about,
before the one you were looking for.  Then, just type another C-S and
the cursor will find the next FOO.  This can be done any number of
times.  If you overshoot, you can rub out the C-S's.

  If your string is not found at all, the echo area says "Failing
I-Search".  The cursor will be after the place where EMACS found as
much of your string as it could.  Thus, if you search for FOOT, and
there is no FOOT, you might see the cursor after the FOO in FOOL.  At
this point there are several things you can do.  If your string was
mistyped, you can rub some of it out and correct it.  If you like the
place you have found, you can type Altmode or some other EMACS command
to "accept what the search offered".  Or you can type C-G, which will
throw away the characters that could not be found (the "T" in "FOOT"),
leaving those that could be found (the "FOO" in "FOOT").  A second C-G
at that point would undo the search entirely.

  The C-G "quit" command does special things during searches; just
what, depends on the status of the search.  If the search has found
what you specified and is waiting for input, C-G cancels the entire
search.  The cursor moves back to where you started the search.  If
C-G is typed while the search is actually searching for something, or
after search failed to find some of your input (searched all the way
to the end of the file), then only the characters which have not been
found are discarded.  Having discarded them, the search is now
successful and waiting for more input, so a second C-G will cancel the
entire search.  Make sure you wait for the first C-G to ding the bell
before typing the second one; if typed too soon, the second C-G may be
confused with the first and effectively lost.

  You can also type C-R at any time to start searching backwards.
If a search fails because the place you started was too late in the
file, you should do this.  Repeated C-R's will keep looking for more
occurrences backwards.  A C-S will start going forwards again.  C-R's
can be rubbed out just like anything else.  If you know that you want
to search backwards, you can use C-R instead of C-S to start
searching backwards.

Indexentry:String Search,Character Search
  A non-incremental search is also available.  Just type Altmode right
after the C-S to get it.  Do M-X Describe^R String Search<cr> for
details.  Some people who prefer non-incremental searches put that
function on Meta-S, and ^R Character Search (do M-X Describe for
details) on C-S.

EMACS  Node: Replace, Previous: Search, Up: Search

Chapter:Replacement Commands
Indexentry:searching,replacement,Replace String,Query Replace,Case Replace

  To replace every instance of FOO with BAR, you can do
M-X ReplaceFOOBAR<cr>.  Replacement is done only after the pointer,
so if you want to cover the whole buffer you must go to the beginning
first.  Unless QCase Replace is zero, an attempt will be made to
preserve case; give both FOO and BAR in lower case, and if a
particular FOO is found with a capital initial or all capitalized, the
BAR which replaces it will be likewise.

Indexentry:C-X N,narrowing,C-X W
  To restrict the replacement to a subset of the buffer, set the
region around it and type C-X N ("N" for "Narrow").  This will make
all of the buffer outside that region temporarily invisible (but the
commands that save your file will still know that it is there!).  Then
do the replacement.  Afterward, C-X W ("Widen") to make the rest of
the buffer visible again.{+INFO:  *Note Narrowing: Narrowing.}

  If you are afraid that there may be some FOO's that should not
be changed, EMACS can still help you.  Use M-X Query ReplaceFOOBAR.
This will display each FOO and wait for you to say whether to replace
it with a BAR.  The things you can type when you are shown a FOO are:{+Guide:@~}

      Space	to replace the FOO (preserving case, just like
		plain Replace, unless QCase Replace is zero);
      Rubout	to skip to the next FOO without replacing this one;
      Comma  	to replace this FOO and display the result.
		You are then asked for another input character,
		except that since the replacement has already been
		made, Rubout and Space are equivalent.
      Altmode	to stop replacing, not replacing this FOO;
      Period 	to replace this FOO but not look for any more;
	!	to replace all remaining FOO's without asking
		(Replace actually works by calling Query Replace
		and pretending that a ! was typed in);
	^	to go back to the previous FOO (or, where it was),
		in case you have made a mistake.  This works by
		jumping to the mark (Query Replace sets the mark each
		time it finds a FOO).
	C-W	to delete the FOO, and then start editing the buffer.
		When you are finished editing whatever is to replace
		the FOO, exit the recursive edit with C-C C-C.
	C-R	to enter EMACS recursively, in case the FOO needs to
		be edited rather than just replaced with a BAR.  When
		you are done, exit the recursive edit with C-C C-C.

If you type any other character, the Query Replace will be exited, and
the character will be then executed as a command.  To restart the
Query Replace, use C-X Altmode which is a command to re-execute the
previous minibuffer command or extended command.

Indexentry:C-X Altmode
Indexentry:numeric arguments
  If you give Replace or Query Replace an argument, then it insists
that the occurrences of FOO be delimited by break characters (or an
end of the buffer).  So you can find only the word FOO, and not FOO
when it is part of FOOBAR.

  The FOO string argument to Replace and Query Replace is actually a
TECO search string.  This means that the characters C-X, C-B, C-N,
C-O, C-Q and C-] have special meanings.  C-X matches any character.
C-B matches any "delimiter" character (anything which the word
commands consider not part of a word, according to the syntax table).
C-N negates what follows, so that C-N A matches anything but A, and
C-N C-B matches any non-delimiter.  C-O means "or", so that XYXY C-O
ZZZ matches @xxii[either] XYXY or ZZ.  C-Q quotes the following character, in
case you want to search for one of the special control characters.
However, you can't quote an Altmode or a Return in this way because
its specialness is at an earlier stage of processing.

  Meta-% will give you a mini-buffer pre-initialized with "MM Query
Replace".  This is the easiest way to invoke Query Replace.
It also allows you to get Returns and Altmodes into the arguments.
When you invoke Query Replace from the minibuffer, the character C-]
becomes special (because it is special in TECO programs).  In order to
get a C-] into the search string or the replacement string, you must
use two of them.  You can also use a C-] to quote an Altmode.  In the
minibuffer, Return has no syntactic significance, so there is no need
for a way to quote it.  However, in order to insert any control
characters into the arguments, you will need to quote them again with
C-Q.  So, to get C-Q C-X into the search string so as to search for a
C-X, you will have to type C-Q C-Q C-Q C-X.

  Here are some other functions related to replacement.  Their
arguments are TECO search strings.  They all operate starting from the
pointer, on to the end of the buffer (or where C-X N stops them).

indexentry:Occur,How Many,Keep Lines,Flush Lines,deletion,replacement
{-TRUTH:each command name has a tab character after it!}
M-X OccurFOO<cr>	
		which finds all occurrences of FOO after the pointer.
		It prints each line containing one.  With an argument,
		it prints that many lines before and after each

M-X How ManyFOO<cr>	
		types the number of occurrences of FOO after the

M-X Keep LinesFOO<cr>	
		kills all lines after the pointer that don't contain

M-X Flush LinesFOO<cr>	
		kills all lines after the pointer that contain FOO.

EMACS  Node: Fixit,  Previous: Search,  Up: Top,  Next: Programs

Chapter:Commands for Fixing Typos

	Rubout		Delete last character.
	M-Rubout	Kill last word.
	C-X Rubout	Kill to beginning of sentence.
	C-T		If typed at the end of a line,
			transposes last two characters.
	M-Minus M-L	Convert last word to lower case.
	M-Minus M-U	Convert last word to all upper case.
	M-Minus M-C	Convert last word to lower case with
			capital initial.
	M-'		Fix up omitted shift key on digit.

  In this section are described the commands that are especially
useful for the times when you catch a mistake in your text just after
you have made it, or change your mind when writing something on line.

  The Rubout command is the most important correction command.  When
used among printing (self-inserting) characters, it can be thought of
as canceling the last character typed.

indexentry:M-Rubout,C-X Rubout,words,sentences,killing
  When your mistake is longer than a couple of characters, it might be
more convenient to use M-Rubout or C-X Rubout.  M-Rubout kills back to
the start of the last word, and C-X Rubout kills back to the start of
the last sentence.  C-X Rubout is particularly useful when you are
thinking of what to write as you type it, in case you change your mind
about phrasing.   M-Rubout and C-X Rubout save the killed text for C-Y
and M-Y to retrieve{+INFO: (*Note Un-kill: Un-killing.).}

  M-Rubout is often useful even when you have typed only a few
characters wrong, if you know you are confused in your typing and
aren't sure exactly what you typed.  At such a time, you cannot
correct with Rubout except by looking at the screen to see what you
did.  It is often faster just to kill the whole word and start over
again, especially if the system is heavily loaded.

  The common error of transposing two characters can be fixed, when
they are adjacent, with the C-T command.  Normally, C-T transposes the
two characters on either side of the cursor.  When given at the end of
a line, rather than transposing the last character of the line with
the Return, which would be useless, C-T transposes the last two
characters on the line.  So, if you catch your transposition error
right away, you can fix it with just a C-T.  If you don't catch it so
fast, you must move the cursor back to between the two transposed
characters.  If you transposed a space with the last character of the
word before it, the word motion commands are a good way of getting
there.  Otherwise, a reverse search (C-R) is often the best way.

indexentry:M-- M-L,M-- M-U,M-- M-C,case conversion,words
  A very common error is to type words in the wrong case.  Because of
this, the word case-conversion commands M-L, M-U and M-C have a
special feature when used with a negative argument: they do not move
the cursor.  As soon as you see you have mistyped the last word you
can simply case-convert it and go on typing, without additional
commands to move the cursor either before or after the case-conversion
command.{+INFO:  *Note Case: Case.}

Indexentry:M-',typos,^R Upcase Digitr
  Another common error is to type a special character and miss the
shift key, producing a digit instead.  There is a special command just
for fixing this: M-' (^R Upcase Digit), which fixes the last digit
before the pointer in this way (but only if that digit appears on the
current line or the previous line.  Otherwise, to minimize random
effects of an accidental use, M-' does nothing).  Once again, the
cursor does not move, so you can use M-' when you notice the error and
just continue typing.  Because M-' needs to know the arrangement of
your keyboard, the first time you use it it asks you for the
information it needs to know.  You supply the information by typing
the row of digits 1, 2, ... , 9, 0 but @xxii[holding down the shift key].
This tells M-' the correspondence between digits and special
characters, which is remembered for the duration of the EMACS.

EMACS  Node: Programs,  Previous: Fixit,  Up: Top,  Next: Text

Chapter:Commands for Editing Programs

{+Guide: Special features for editing programs include automatic
indentation, comment alignment, parenthesis matching, and the ability
to move over and kill balanced expressions.  In addition, paragraphs
are defined to run between blank lines, so sections of code can be
referred to conveniently with the paragraph commands.
}{+INFO:* Menu:

* Indenting::		Automatic indentation of code
* Matching::		Automatic display of how parentheses match
* Lists::		moving over and killing LISP objects
* DEFUNs::		moving over and marking LISP functions
* Comments::		inserting, deleting, aligning comments
* Grinding::		grinding LISP code
* MIDAS::		commands for editing code written in
			MIDAS or any other assembler.

*Note Words: Words	moving over words is useful for editing
			programs as well as text.

*Note Paragraphs: Sentences
			Most programming language major modes define
			paragraphs to be separated only by blank lines
			and page boundaries.  This makes the paragraph
			commands useful for editing programs.

*Note Tags: (TAGS)	The TAGS package can remember all the labels
			or functions in a multi-file program
			and find any one of them quickly.
EMACS  Node: Indenting, Previous: Programs, Up: Programs, Next: Matching

Section:Indentation Commands for Code

  Most programming languages have some indentation convention.  For
LISP code, lines are indented according to their nesting in
parentheses.  For assembler code, almost all lines start with a single
tab, but some have one or more spaces as well.  Indenting TECO code is
an art rather than a science, but it is often useful to indent a line
under the previous one.

  The way to request indentation is with the Tab command.  Its precise
effect depends on the major mode.  In LISP mode, Tab aligns the line
according to its depth in parentheses.  No matter where in the line
you are when you type Tab, it aligns the line as a whole.  In MIDAS
mode, Tab inserts a tab, that being the standard indentation for
assembly code.  PL1 mode knows in great detail about the keywords of
the language so as to indent lines according to the nesting structure.
{+INFO:*Note PL1: (EPL1).
Indexentry:Linefeed,^R Indent New Line
  The command Linefeed (^R Indent New Line) does a Return and then
does a Tab on the next line.  Thus, Linefeed at the end of the line
makes a following blank line and supplies it with the usual amount of
indentation, just as Return would make an empty line.  Linefeed in the
middle of a line breaks the line and supplies the usual indentation in
front of the new line.

indexentry:M-^,C-M-^,^R Delete Indentation,M-\,^R Delete Horizontal Space
  The inverse of Linefeed is Meta-^ or C-M-^ (^R Delete Indentation).
This command deletes the indentation at the front of the current line,
and the line boundary as well.  They are replaced by a single space,
or by no space if before a ")" or after a "(".  To delete just the
indentation of a line, go to the beginning of the line and use Meta-\
(^R Delete Horizontal Space), which deletes all spaces and tabs around
the cursor.

  To insert an indented line before the current one, do C-A, C-O, and
then Tab.
  To make an indented line after the current one, use C-E Linefeed. 

  To move over the indentation on a line, do Meta-M or C-M-M (^R Back
to Indentation).  These commands, given anywhere on a line, will
position the cursor at the first nonblank character on the line.

EMACS  Node: Matching, Previous: Indenting, Up: Programs, Next: Lists

Section:Automatic Indication Of How Parentheses Match

  The purpose of the EMACS parenthesis-matching feature is to show
automatically how parentheses balance in text being typed in.  When
this feature is enabled, then after a closeparen or other closebracket
character is inserted the cursor will automatically move for an
instant to the open which balances the newly inserted character.  The
cursor will stay at the openparen for a second before returning home,
if you don't type any more commands during that time.  If you type
more commands before the second is up, EMACS won't wait the whole

  It is worth emphasizing that the real location of the cursor -- the
place where your type-in will be inserted -- is not affected by the
closeparen matching feature.  It stays after the closeparen, where it
would normally be.  Only the spot on the screen moves away and back.
You can type ahead freely as if the matching feature were not there.
In fact, if you type fast enough, you won't see the cursor move.
You must pause after typing a closeparen to see the openparen.

Indexentry:Display Matching Paren,Permit Unmatched Paren
  The variable Display Matching Paren controls parenthesis display.
If it is zero, the feature is disabled.  If the variable is nonzero,
then its absolute value is the number of seconds for the cursor to
stay at the openparenthesis before coming back to its real location.
The sign of the variable is also significant: if it is negative, then
the openparenthesis will be shown only if it is already on the screen.
If the variable is positive, then EMACS will actually recenter the
window to show the text around the openparenthesis.  The default
setting of the variable is -1.

  An additional parameter is whether EMACS should warn you if you type
an unmatched closeparenthesis.  The default is that it will do so when
you are editing a language in which parentheses are essential, like
Lisp, but will not do so for languages in which parentheses are not so
crucial.  This is controlled by the variable Permit Unmatched Paren.
When it is 1, you are never warned (they are always "permitted").
When it is -1, you are warned only in Lisp mode and similar modes
(this is the default).  Note that these modes operate by locally
setting the variable to 1 if it was -1.  When it is 0, you are warned
regardless of the major mode.  Note that unmatched parens are
@XXI[always] "permitted" in that EMACS will never refuse to insert

Indexentry:Text Mode,Text Mode Hook,syntax table,TECO
  While this feature was intended primarily for LISP, it can be used
just as well for any other language, and it is not dependent on what
major mode you are in.  It is expected that you wouldn't want
it in Text mode, so Text mode sets the variable Display Matching Paren
locally to zero.  If you do want the feature in text mode, you can
create a Text Mode Hook variable which sets the variable back to -1.
{+INFO:*Note Hooks: (EMACS;CONV)Hooks, for more info on Text Mode Hook.
}The way to control which characters trigger this feature is with the
syntax table.  Any character whose Lisp syntax is ")" will cause the
matching character with syntax "(" to be shown.  Most major modes will
automatically set up the syntax table.{+INFO:  *Note Syntax: Syntax.}

  The syntax table also controls what is done with the case of
"mismatched" parens, as in "[)".  The third slot in a closeparen
character's syntax table entry should be the proper matching openparen
character, if you want this feature turned on.  If that slot contains
a Space instead, then any openparen character will be considered a
legitimate match.

  The implementation of this feature uses the TECO flag FS ^R PAREN.

EMACS  Node: Lists, Previous: Matching, Up: Programs, Next: DEFUNs

Section:Moving Over and Killing Lists and S-expressions

	C-M-F		move Forward over s-expression
	C-M-B		move Backward
	C-M-K		Kill s-expression forward
	C-M-Rubout	kill s-expression backward
	C-M-U		move Up and backward in list structure
	C-M-(		the same
	C-M-)		move up and forward in list structure
	C-M-D		move Down and forward in list structure
	C-M-N		move forward over a list
	C-M-P		move backward over a list
	C-M-T		Transpose s-expressions
	C-M-@@		put mark after s-expression

  By convention, EMACS commands that deal with LISP objects are
usually Control-Meta- characters.  They tend to be analogous in
function to the Control- and Meta- characters with the same basic

  To move forward over an s-expression, use C-M-F (^R Forward Sexp).
If the first non-"useless" character after point is an "(", C-M-F
moves past the matching ")".  If the first character is a ")", C-M-F
just moves past it.  If the character begins an atom, C-M-F moves to
the atom-break character that ends the atom.  C-M-F with an argument
repeats that operation the specified number of times; with a negative
argument, it moves backward instead.

  The command C-M-B (^R Backward Sexp) moves backward over an
s-expression;  it is like C-M-F with the argument negated.  If there
are "'"-like characters in front of the s-expression moved over, they
are moved over as well.  Thus, with the pointer after " 'FOO ", C-M-B
would leave the pointer before the "'", not before the "F".

  These two commands (and most of the commands in this section) do not
know how to deal with the presence of comments. 
Although that would be easy to fix for forward motion, for backward
motion the syntax of LISP makes it nearly impossible.  Comments by
themselves wouldn't be so bad, but handling comments and "|" both
is impossible to do locally.  In a line " ((FOO ; | BAR ", are the
open parentheses inside of a "| ... |" atom?  I do not think it would
be advisable to make C-M-F handle comments without making C-M-B handle
them as well. 

  For this reason, two other commands which move over lists instead of
s-expressions are often useful.  They are C-M-N (^R Forward List) and
C-M-P (^R Backward List).  They act just like C-M-F and C-M-B except
that they don't stop on atoms;  after moving over an atom, they move
over the next expression, stopping after moving over a list.  With
this command, you can avoid stopping after all of the words in a

  Killing an s-expression at a time can be done with C-M-K and
C-M-Rubout (^R Forward Kill Sexp and ^R Backward Kill Sexp).  C-M-K
kills the characters that C-M-F would move over, and C-M-Rubout kills
what C-M-B would move over.

  C-M-F and C-M-B stay at the same level in parentheses, when that's
possible.  To move @xxii[up] one (or n) levels, use C-M-( or C-M-)
(^R Backward Up List and ^R Forward Up List).  C-M-( moves backwards
up past one containing "(".  C-M-) moves forwards up past one
containing ")".  Given a positive argument, these commands move up the
specified number of levels of parentheses.  C-M-U is another name for
C-M-(, which is easier to type, especially on non-Meta keyboards.  If
you use that name, it is useful to know that a negative argument makes
the command move up forwards (ie, behave like the C-M-) command).

  To move @xxii[down] in list structure, use C-M-D (^R Down Sexp).  It is
nearly the same as searching for a "(".

  A somewhat random-sounding command which is nevertheless easy to use
is C-M-T (^R Transpose Sexps), which moves the cursor forward over one
s-expression, dragging the previous s-expression along.  An argument
serves as a repeat count, and a negative argument drags backwards
(thus canceling out the effect of a positive argument).  An argument
of zero, rather than doing nothing, transposes the s-expressions at the
point and the mark.

  To perform a miscellaneous operation on the next s-expression in the
buffer, use or C-M-@@ (^R Mark Sexp) which sets mark at the same
place that C-M-F would move to.  C-M-@@ takes arguments like
C-M-F.  In particular, a negative argument is useful for putting the
mark at the beginning of the previous s-expression.

EMACS  Node: DEFUNs, Previous: Lists, Up: Programs, Next: Comments

Section:Commands for Manipulating DEFUNs

	C-M-[,C-M-A	move to beginning of DEFUN
	C-M-],C-M-E	move to end of DEFUN
	C-M-H		put region around wHole DEFUN

  In EMACS, a list at the top level in the buffer is called a DEFUN,
regardless of what function is actually called, because such lists
usually call DEFUN.  There are EMACS commands to move to the beginning
or end of the current DEFUN: C-M-[ (^R Beginning of DEFUN) moves to
the beginning, and C-M-] (^R End of DEFUN) moves to the end.  If you
wish to operate on the current DEFUN, use C-M-H (^R Mark DEFUN) which
puts point at the beginning and mark at the end of the current or next
DEFUN.  Alternate names for these two commands are C-M-A for C-M-[ and
C-M-E for C-M-].  The alternate names are easier to type on many
non-Meta keyboards.

Indexentry:syntax table
  The list commands' understanding of syntax is completely controlled
by the syntax table.  Any character can, for example, be declared to
act like an open parenthesis.  If you find that you are being "screwed
by macro characters" then you may be able to win by changing their
syntax.{+INFO:  *Note Syntax: Syntax.}

EMACS  Node: Comments, Previous: DEFUNs, Up: Programs, Next: Grinding

Section:Commands for Manipulating Comments

	C-;	insert or align comment
	M-;	the same
	C-M-;	kill comment
	C-X ;	set comment column
	M-N	move to Next line and insert comment
	M-P	move to Previous line and insert comment
	M-J	continue a comment on a new line
	M-Lf	the same

  The command that creates a comment is Control-; or Meta-;
(^R Indent for Comment).  It moves to the end of the line, indents to
the comment column, and inserts whatever string EMACS believes
comments are supposed to start with (normally ";").  If the line goes
past the comment column, then the indentation is done to a suitable
boundary (usually, a multiple of 8).  If the language you are editing
requires a terminator for comments (other than the end of the line),
the terminator will be inserted too, but point goes between the
starter and the terminator.

  Control-; can also be used to align an existing comment.  If a line
already contains the string that starts comments, then C-; just moves
point after it and indents it to the right place (where a comment
would have been created if there had been none).

  Even when an existing comment is properly aligned, C-; is still
useful for moving directly to the start of the comment.

Indexentry:numeric arguments
  If you wish to align a large number of comments, you can give
Control-; an argument and it will indent what comments exist on
that many lines, creating none.  Point will be left after the last
line processed (unlike the no-argument case).

  When adding comments to a long stretch of existing code, the
commands M-N (^R Down Comment Line) and M-P (^R Up Comment Line) may
be useful.  They are like C-N and C-P except that they do a C-;
automatically on each line as you move to it, and delete any empty
comment from the line as you leave it.  Thus, you can use M-N to move
down through the code, putting text into the comments when you want
to, and allowing the comments that you don't fill in to be removed
because they remained empty.

Indexentry:M-J,M-Linefeed,blank lines
  If you are typing a comment and find that you wish to continue it on
another line, you can use the command Meta-J or Meta-Linefeed (^R
Indent New Comment Line), which terminates the comment you are typing,
creates or gobbles a new blank line, and begins a new comment indented
under the old one.  Note that if the next line is not blank, a blank
line is created, instead of putting the next line of the comment on
the next line of code.  To do that, you should use M-N.

indexentry:Comment Column,C-X ;
  The comment column is stored in the variable QComment Column.  You
can set it to a number explicitly.  Alternatively, the command C-X;
(^R Set Comment Column) sets the comment column to the column point is
at.  C-U C-X; sets the comment column to match the last comment before
point in the buffer, and then does a Meta-; to align the current
line's comment under the previous one.

Indexentry:major modes
  Many major modes supply default local values for the comment column.
In addition, C-X ; automatically makes the variable Comment Column
local.  Otherwise, if you change it it will be changed globally (for
all buffers that don't have it as a local) unless you make it local

  C-M-; (^R Kill Comment) kills the comment on the current line, if
there is one.  The indentation before the start of the comment is
killed as well.  If there does not appear to be a comment in the line,
nothing is done.

Indexentry:Comment Start,Comment Begin
  The string recognized as the start of a comment is stored in the
variable QComment Start, while the string used to start a new
comment is kept in QComment Begin (if that is zero, Comment Start is
used for new comments).  This makes it possible for you to have any
";" recognized as starting a comment but have new comments begin with
"; ".

Indexentry:Comment End
  The string used to end a comment is kept in the variable QComment
End.  In many languages no comment end is needed as the comment
extends to the end of the line.  Then, this variable is a null string.

EMACS  Node: Grinding, Previous: Comments, Up: Programs, Next: MIDAS

Section:LISP Grinding

  The best way to keep LISP code indented properly is to use EMACS to
re-indent it when it is changed.  EMACS has commands to indent
properly either a single line, a specified number of lines, or all of
the lines inside a single s-expression.

  The basic indentation function is ^R Indent for LISP, which gives
the current line the correct indentation as determined from the
previous lines' indentation and parenthesis structure.  This function
is normally found on C-M-Tab, but when in LISP mode it is placed on
Tab as well (Use Meta-Tab to insert a Tab).  When given at the
beginning of a line, it leaves point after the indentation; when given
inside the text on the line, point remains fixed with respect to the
characters around it.

  When entering a large amount of new code, it becomes useful that
Linefeed is equivalent to a Return followed by a Tab.  In LISP mode, a
Linefeed will create or move down onto a blank line, and then give
it the appropriate indentation.

  If you wish to join two lines together, you can use the Meta-^ or
Control-Meta-^ command (^R Delete Indentation), which is approximately
the opposite of Linefeed.  It deletes any Spaces and Tabs at the front
of the current line, and then deletes the CRLF separating it from the
preceding line.  A single space is then inserted, if EMACS thinks that
one is needed there.

  If you are dissatisfied about where Tab wants to place the second
and later lines of an s-expression, you can override it.  If you alter
the indentation of one of the lines yourself, then Tab will indent
successive lines of the same list to be underneath it.  This is the
right thing for functions which Tab indents unaesthetically.  Of
course, it is the wrong thing for PROG tags (if you like to un-indent
them), but it's impossible to be right for both.

Indexentry:numeric arguments
  When you wish to re-indent code which has been altered or moved to a
different level in the list structure, you have several commands
available.  You can re-indent a specific number of lines by giving the
ordinary indent command (Tab, in LISP mode) an argument.  It will
indent as many lines as you say and move to the line following them. 
Thus, if you underestimate, you can repeat the process later.

  You can re-indent the contents of a single s-expression by
positioning point before the beginning of it and typing Control-Meta-Q
(^R Indent Sexp).  The line the s-expression starts on is not
re-indented;  thus, only the relative indentation with in the
s-expression, and not its position, is changed.  To correct the
position as well, simply give a Tab before the C-M-Q.

  Another way to specify the range to be re-indented is with point and
mark.  The command C-M-\ (^R Indent Region) applies Tab to every line
whose first character is between point and mark.  In LISP mode, this
does a LISP indent.

  A more powerful grind command which can move text between lines is
C-M-G (^R Format Code).  You might or might not like it.  It knows in
different ways about Lisp code and Macsyma code.

EMACS  Node: MIDAS, Previous: Grinding, Up: Programs

Section:Commands for Editing Assembly Language Programs

  M-X MIDAS Mode provides several commands that know the format of
labels and instructions in MIDAS and other PDP-10 and PDP-11
assemblers.{+Twenex:  Macro Mode and FAIL Mode also exist but are only
very slightly different from MIDAS Mode.}  These commands are:

	C-M-N	Go to Next label
	C-M-P	Go to Previous label
	C-M-A	Go to Accumulator field of instruction
	C-M-E	Go to Effective Address field
	C-M-D	Kill next word and its Delimiting character
	M-[	move up to previous paragraph boundary
	M-]	move down to next paragraph boundary

  Any line which is not indented and is not just a comment is taken to
contain a label.  The label is everything up to the first whitespace
(or the end of the line).  C-M-N and C-M-P both position the cursor
right at the end of a label;  C-M-N moves forward or down and C-M-P
moves backward or up.  At the beginning of a line containing a label,
C-M-N moves past it.  Past the label on the same line, C-M-P moves
back to the end of it.  If you kill a couple of indented lines and
want to insert them right after a label, these commands put you at
just the right place.

  C-M-A and C-M-E move to the beginning of the AC or EA fields of a
PDP-10 instruction.  They always stay on the same line, and will move
either forward or backward as appropriate.  If the instruction
contains no AC field, C-M-A will position to the start of the address
field.  If the instruction is just an opcode with no AC field or
address field, a space will be inserted after the opcode and the
cursor left after the space.

  Once you've gone to the beginning of the AC field you can often use
C-M-D to kill the AC name and the comma which terminates it.  You can
also use it at the beginning of a line, to kill a label and its colon,
or after a line's indentation to kill the opcode and the following
space.  This is very convenient for moving a label from one line to
another.  In general, C-M-D is equivalent to M-D C-D, except that all
the characters are saved on the kill ring, together.  C-D, a
"deletion" command, doesn't save on the kill ring if not given an

Indexentry:Paragraph Delimiter
  The M-[ and M-] commands are not, strictly speaking, redefined by
MIDAS mode, since they always go up or down to a paragraph boundary.
However, in MIDAS mode the criterion for a paragraph boundary is
redefined by changing QParagraph Delimiter{+INFO: (*Note para: Sentences.)}
so that only blank lines (and pages) delimit paragraphs.  So, M-[ will
move up to the previous blank line and M-] will move to the next one.{*Refill:}

EMACS  Node: Text,  Previous: Programs,  Up: Top, Next: Paging

Chapter:Commands Good for English Text

{+Guide:EMACS allows the user to manipulate words, sentences, or
paragraphs of his text.  In addition, there are commands to fill text,
and convert case.{+ITS:  For text-justifier input files, there are commands
that may help manipulate fontchange commands and underlining.}

}{+INFO:* Menu:

* Words::		moving over and killing words
* Sentences::		moving over sentences and paragraphs
* TextIndent::		manipulation of indentation
* Filling::		filling or justifying text
* Case::		changing the case of text
* Fonts::		changing the font of text (for text justifiers)
* Underlining::		underlining (for text justifiers)
EMACS  Node: Words,  Previous: Text,  Up: Text,  Next: Sentences

Section:Word Commands

  EMACS has commands for moving over or operating on words.  By
convention, they are all Meta- characters.

	M-F		Move Forward over a word
	M-B		Move Backward over a word
	M-D		Kill up to the end of a word
	M-Rubout	Kill back to the beginning of a word
	M-@@		Mark the end of the next word
	M-T		Transpose two words;  drag a word forward
			 or backward across other words.

  Notice how these commands form a group that parallels the character
based commands C-F, C-B, C-D, C-T and Rubout.  M-@@ is related to C-@@.

  The commands Meta-F and Meta-B move forward and backward over words.
They are thus analogous to Control-F and Control-B, which move over
single characters.  Like their Control- analogues, Meta-F and Meta-B
will move several words if given an argument, and can be made to go in
the opposite direction with a negative argument.  Forward motion stops
right after the last letter of the word, while backward motion stops
right before the first letter.

  It is easy to kill a word at a time.  Meta-D
(^R Forward Kill Word) kills the word after point.  To be precise, it
kills everything from point to the place Meta-F would move to.  Thus,
if point is in the middle of a word, only the part after point is
killed.  If some punctuation comes after point and before the next
word, it is killed along with the word.  If you wish to kill only the
next word but not the punctuation, simply do Meta-F to get the end,
and kill the word backwards with Meta-Rubout.  Meta-D takes arguments
just like Meta-F. 

  Meta-Rubout (^R Backward Kill Word) kills the word before point.  It
kills everything from point back to where Meta-B would move to.  If
point were after the Space in "FOO, BAR", "FOO, " would be killed.  In
such a situation, to avoid killing the Comma and Space, do a Meta-B
and a Meta-D instead of a Meta-Rubout.

indexentry:transposition,numeric arguments,M-T
  Meta-T (^R Transpose Words) moves the cursor forward over a word,
dragging the word behind (or around) the cursor forward along with it.
A numeric argument serves as a repeat count.  A negative argument
undoes the effect of a positive argument;  it drags the word behind
the cursor backward over a word.  An argument of zero, instead of
doing nothing, transposes the word at point with the word at mark.

  To operate on the next n words with an operation which applies
between point and mark, you can either set the mark at point and then
move over the words, or you can use the command Meta-@@ (^R Mark Word)
which does not move point, but sets the mark where Meta-F would move
to.  They can be given arguments just like Meta-F.  The case conversion
operations alternative forms that apply to words, since they are
particularly useful that way.

indexentry:Atom Word Mode
  Note that if you are in Atom Word Mode and in LISP mode, all the
word commands move over/kill/mark LISP atoms.

Indexentry:syntax table
  The word commands' understanding of syntax is completely controlled
by the syntax table.  Any character can, for example, be declared to
be a word delimiter.{+INFO:  *Note Syntax: Syntax.}

EMACS  Node: Sentences, Previous: Words, Up: Text, Next: TextIndent

Section:Sentence and Paragraph Commands

  The EMACS commands for manipulating sentences and paragraphs are all
Meta- commands, so as to resemble the word-handling commands.

	M-A	move back to the beginning of the sentence.
	M-E	move forward to the end of the sentence.
	M-K	kill this or next sentence.
	M-[	move back to previous paragraph boundary.
	M-]	move forward to next paragraph boundary.
	M-H	put point and mark around this paragraph
		(around the following one, if between paragraphs).
	C-X Rubout	kill back to beginning of sentence.

  The commands Meta-A and Meta-E (^R Backward Sentence and ^R Forward
Sentence) move to the beginning and end of the current sentence,
respectively.  They were chosen to resemble Control-A and Control-E,
which move to the beginning and end of a line, but unlike those
Control characters Meta-A and Meta-E will if repeated move over
several sentences.  EMACS considers a sentence to end wherever there
is a ".", "?" or "!" followed by the end of a line or two Spaces, with
any number of ")"'s, "]"'s, "'"'s, or '"' 's allowed in between.  The
sentence which is ending there is currently considered to include the
Spaces or CRLF, so that Meta-E moves past them while Meta-A stays
after them.  Is this right?  Please mail me your opinion.

Indexentry:C-A,C-E,C-K,killing,M-K,C-X Rubout
  Just as C-A and C-E have a kill command, C-K, to go with them, so
M-A and M-E have a corresponding kill command M-K (^R Kill Sentence).
This kills the sentence that is around point.  If point is between
sentences, the sentence after point is killed.

  The command C-X Rubout (^R Backward Kill Sentence) is useful when
you change your mind about a thought after a phrase or two.  It kills
backward from point to the beginning of the sentence.

  There are similar commands for moving over paragraphs.  Meta-[ (^R
Backward Paragraph) moves to the beginning of the current or previous
paragraph, while Meta-] (^R Forward Paragraph) moves to the beginning
of the next paragraph.  More precisely, a paragraph boundary occurs on
any blank line followed by a non-blank line, and also on any non-blank
line following a non-blank line and beginning with one of a
user-specifiable set of characters, usually Space, Tab and Period, or
beginning with a page-separator.  Meta-[ moves backwards till it finds
such a boundary, while Meta-] moves forwards till it finds one.  In
addition, whenever a line starting with Period or "-" or "\" starts a
paragraph, that line is a paragraph to itself;  the next nonblank line
always starts another paragraph.  This is useful for text justifier

Indexentry:blank lines
  In major modes for programs (as opposed to Text mode), paragraphs
are determined only by blank lines.  This makes the paragraph commands
continue to be useful even though there are no paragraphs per se.

indexentry:region,mark,C-W,C-U C-@@,M-H
  When you wish to operate on a paragraph, you can use the command
Meta-H (^R Mark Paragraph) to prepare.  This command puts point at the
beginning and mark at the end of the paragraph point was in.  Before
setting the new mark at the end, a mark is set at the old location of
point;  this allows you to undo a mistaken Meta-H with two C-U C-@@'s.
If point is between paragraphs (in a run of blank lines, or at a
boundary), the paragraph following point is surrounded by point and
mark.  Thus, for example, Meta-H C-W would kill the paragraph around
or after point.

  One way to make an "invisible" paragraph boundary that will not show
if the file is printed is to put Space-Backspace at the front of a
line.  The Space will make the line appear (to the EMACS paragraph
commands) to be indented, which will usually mean that it starts a
paragraph (according to QParagraph Delimiter).

indexentry:Paragraph Delimiter,TECO,Page Delimiter,pages
  The variable QParagraph Delimiter should be a TECO search string
composed of various characters separated by C-O's.  A line is taken to
start a paragraph if it begins with one of those characters (or with a
page separator: see QPage Delimiter).  Of course, any blank line
followed by a nonblank line always starts a paragraph regardless of
QParagraph Delimiter.

EMACS  Node: TextIndent, Previous: Sentences, Up: Text, Next: Filling

Section:Indentation Commands for Text

	Tab		Indents line "appropriately".
	M-Tab		Inserts a Tab character.
	Linefeed	Is the same as Return and Tab.
	M-^		Undoes a Linefeed.  Merges two lines.
	M-M		Moves to the line's first nonblank character.
	M-I		Indent to Tab stop
	C-M-\		Indent several lines to same column.
	C-X Tab		Shift block of lines rigidly right or left.

  The way to request indentation is with the Tab command.  Its precise
effect depends on the major mode.  In Text mode, it indents to the
next tab stop.  You can set the tab stops with Edit Tab Stops (see
below).  If you just want to insert a Tab character in the buffer, you
can use M-Tab.

Indexentry:Edit Indented Text
  For English text, the usual convention is that only the beginning of
a paragraph is indented.  You don't need any special hackery not to
indent lines.  But sometimes you want to have an indented paragraph.
For this, use M-X Edit Indented Text, which enters a submode in which
Tab and the paragraph commands are suitably redefined.

Indexentry:Auto Fill Mode,Space Indent Flag,Edit Table
  When Auto Fill mode needs to break an overlong line, it usually
indents the newly started line.  However, in Text mode, this is
inhibited by clearing QSpace Indent Flag.   This is so that Auto
Fill can avoid indenting without denying you the use of Tab to indent.
The Edit Table and Edit Indented Text functions temporarily change the
value of Space Indent Flag.

  To undo a line-break, whether done manually or by Auto Fill, use the
Meta-^ command to delete the indentation at the front of the current
line, and the line boundary as well.  They are replaced by a single
space, or by no space if before a ")" or after a "(".  To
delete just the indentation of a line, go to the beginning of the line
and use Meta-\, which deletes all spaces and tabs around the cursor.

  To insert an indented line before the current one, do C-A, C-O, and
then Tab.
  To make an indented line after the current one, use C-E Linefeed. 

  To move over the indentation on a line, do Meta-M or C-M-M (^R Back
to Indentation).  These commands, given anywhere on a line, will
position the cursor at the first nonblank character on the line.

  For typing in tables, you can use Text mode's definition of Tab, ^R
Tab to Tab Stop, which may be given anywhere in a line, and indents
from there to the next tab stop.  If you are not in Text mode, this
function can be found on M-I anyway.

indexentry:Edit Tab Stops,Tab Stop Definitions,M-I
  Set the tab stops using Edit Tab Stops, which displays for you a
buffer whose contents define the tab stops.  The first line contains a
colon or period at each tab stop.  Colon indicates an ordinary tab,
which you fill to with whitespace; a period specifies that characters
be copied from the corresponding columns of the second line below it.
Thus, you can tab to a column automatically inserting dashes or
periods, etc.  It is your responsibility to put in the second line the
text to be copied.  The third and fourth lines contain column numbers
for your convenience in editing the first two lines.  When you are not
editing the tab stops, they live in a string which is the value of the
variable named Tab Stop Definitions.  This string contains only the
first two lines of what you see in Edit Tab Stops; if the second line
is empty, it need not exist, and the CRLF before it also need not
exist.  This makes the value of the variable fit in one line, which
makes it more convenient to redefine local to a file.{+INFO:
*Note Locals: Locals.}

Indexentry:numeric arguments,C-M-\,C-X Tab
  There are also commands for changing the indentation of several
lines at once.  Control-Meta-\ (^R Indent Region) gives each line
whose first character is between point and mark the "usual"
indentation (as determined by Tab).  With a numeric argument, it gives
each line precisely that much indentation.  C-X Tab (^R Indent
Rigidly) moves all of the lines in the region right by its argument
(left, for negative arguments).

indexentry:Indent Tabs Mode,minor modes,Tabify,Untabify
  Usually, EMACS uses both tabs and spaces to indent.  If you don't
want that, you can use M-X Indent Tabs Mode to turn the use of Tabs on
or off.  To convert all tabs in a file to spaces, you can use M-X
Untabify, whose argument is the number of positions to assume between
tab stops (default is 8).  M-X Tabify performs the opposite
transformation, replacing pairs of spaces with tabs whenever possible.

EMACS  Node: Filling, Previous: TextIndent, Up: Text, Next: Case

Section:Text Filling

	Space	in Auto Fill mode, breaks lines when appropriate.
	M-Q	Fill paragraph.
	M-G	Fill region (G is for Grind, by analogy with Lisp).
	M-S	Center a line.
	C-X =	Show current cursor position

Indexentry:Auto Fill Mode,Space
  EMACS's auto fill mode lets you type in text that is filled (broken
up into lines that just fit into a specified width) as you go.  If you
alter existing text and thus cause it to cease to be properly filled,
EMACS can fill it again if you ask.

  Entering auto fill mode is done with M-X Auto Fill.  From then on,
lines will be broken automatically at spaces when they get longer than
the desired width.  New lines will usually be indented, but in Text
Mode they are not.  To leave auto fill mode, execute M-X Auto Fill

indexentry:numeric arguments
  When you finish a paragraph, you can type Space with an argument of
zero.  If the last word of the paragraph doesn't fit in its line, it
will move to a new one.  But no spaces will be inserted.  Return will
have the same effect, as well as inserting a line boundary.

  If you edit the middle of a paragraph, it will cease to be correctly
filled.  To re-fill a paragraph, use the command Meta-Q (^R Fill
Paragraph).  It causes the paragraph that point is inside, or the one
after point if point is between paragraphs, to be re-filled.  All the
line-breaks are removed, and then new ones are inserted where
necessary.  M-Q is not allowed in programming language modes (whenever
a comment starter is defined).  If you really do want to do filling on
a file containing a program, use M-G.

  If you are not happy with Meta-Q's idea of where paragraphs start
and end (the same as Meta-H's{+INFO:;  *note Para: Sentences.}), you can use
Meta-G (^R Fill Region) which re-fills everything between point and
mark.  Sometimes, it is ok to fill a region of several paragraphs at
once.  Meta-G will recognize a blank line or an indented line as
starting a paragraph and not fill it in with the preceding line.  The
sequence Space-Backspace at the front of a line will prevent it from
being filled into the preceding line but will be invisible when the
file is printed.  However, the full sophistication of the paragraph
commands in recognizing paragraph boundaries is not available.  But
that's what M-G is for.

  Giving an argument to M-G or M-Q causes the text to be justified
instead of filled.  This means that extra spaces will be inserted
between the words so as to make the right margin come out exactly
even.  I do not recommend doing this.  If someone else has uglified
some text by justifying it, you can unjustify it (remove the spaces)
with M-G or M-Q without an argument.

  The command Meta-S (^R Center Line) centers a line within the
current line width.  With an argument, it centers several lines and
moves past them.

indexentry:Fill Column,C-X F
  The maximum line width for filling is stored in QFill Column.
Both types of filling make sure that no line exceeds this width.  The
easiest way to set this variable is to use the command C-X F (^R Set
Fill Column) which places the margin at the column point is on, or
wherever you specify with a numeric argument.  If the fill column has
never been set then the margin defaults to column 70.

indexentry:Fill Prefix,C-X .
  The beginnings of a facility for filling text which is all indented
is embodied in the variable QFill Prefix.  If this variable is
nonzero, it should be a string which is the current "prefix" for text
lines.  Before filling, the prefix is removed from the front of every
line.  After filling, the prefix is reinserted at the front of every
line.  Auto fill inserts the fill prefix at the front of each new
line.  The command C-X . (^R Set Fill Prefix) sets the fill prefix to
what is on the current line up to the pointer.  This feature doesn't
totally win, so suggestions are solicited.

indexentry:Space Indent Flag
  The variable QSpace Indent Flag controls whether auto fill mode
indents the new lines that it creates.  A nonzero value means that
indentation should be done.

EMACS  Node: Case, Previous: Filling, Up: Text{+ITS:, Next: Fonts}

Section:Case Conversion Commands
indexentry:case conversion

  EMACS has commands for converting either a single word or any
arbitrary range of text to upper case or to lower case.

	M-L	Convert following word to lower case.
	M-U	Convert following word to upper case.
	M-C	Capitalize the following word.
	C-X C-L	Convert region to lower case.
	C-X C-U	Convert region to upper case.

  The word conversion commands are the most useful.  Meta-L
(^R Lowercase Word) converts the word after point to lower case,
moving past it.  Thus, successive Meta-L's will convert successive
words.  Meta-U (^R Uppercase Word) converts to all capitals instead,
while Meta-C (^R Uppercase Initial) puts the first letter of the word
into upper case and the rest into lower case.  All these commands will
convert several words at once if given an argument.

indexentry:numeric arguments
  When given a negative argument, the word case conversion commands
apply to the appropriate number of words before point, but do not move
point.  This is convenient when you have just typed a word in the
wrong case.  You can give the case conversion command and continue

  Note that if one of the word case conversion commands is given in
the middle of the word, the part of the word before point is not

indexentry:C-X C-L,C-X C-U,region,confirmation,undo
  The other case conversion commands are C-X C-U (^R Uppercase Region)
and C-X C-L (^R Lowercase Region), which convert everything between
point and mark to the specified case.  Point and mark do not move.
These commands ask for confirmation if the region contains more than
QRegion Query Size characters;  they also save the original contents
of the region so you can undo them.{+INFO:  *Note Undo: Undo.}

EMACS  Node: Fonts, Previous: Case, Up: Text, Next: Underlining

indexentry:Fonts,TJ6,R,text justifiers

  EMACS has commands to insert and move font change commands as
understood by the TJ6 and R text justifiers.  A font change is assumed
to be of the form ^F<digit> meaning select the specified font, or ^F*
meaning select the previously selected font.

	M-#	Change previous word's font, or next word's.
	C-X #	Change font of region.

Indexentry:M-#,words,numeric arguments
  M-# is a command to change the font of a word.  Its action is rather
complicated to describe, but that is because it tries to be as
versatile and convenient as possible in practice.

  If you type M-# with an argument, the previous word is put into the
font specified by the argument.  Point is not changed.  This means
that, if you want to insert a word and put it in a specific font, you
can type the word, then use M-# to change its font, and then go on
inserting.  The font is changed by putting a ^F<digit> before the word
and a ^F* after.

  If you type M-# with no argument, it takes the last font change and
moves it one word forward.  What this implies is that you can change
the font of several consecutive words incrementally by moving after
the first word, issuing M-# with an argument to set that word's font,
and then typing M-# to extend the font change past more words.  Each
M-# advances past one more word.

  M-# with a negative argument is the opposite of M-# with no
argument;  it moves the last font change @xxii[back] one word.  If you type
too many M-#'s, you can undo them this way.  If you move one font
change past another, one or both are eliminated, so as to do the right
thing.  As a result, M-Minus M-# will undo a M-# with an argument --
try it!

indexentry:C-X #,region
  You can also change the font of a whole region by putting point and
the mark around it and issuing C-X #, with the font number as
argument.  C-X # with a negative argument removes all font changes
inside or adjacent to the region.

EMACS  Node: Underlining, Previous: Fonts, Up: Text

Indexentry:underlining,text justifiers,R

  EMACS has two commands for manipulating text-justifier underlining
command characters.  These commands do not produce any sort of
overprinting in the text file itself;  they insert or move command
characters which direct text justifiers to produce underlining.  By
default, commands for the text justifier R are used.

	M-_	Underline previous word or next word.
	C-X _	Underline region.

  M-_ is somewhat like M-# in that it either creates an underline
around the previous word or extends it past the next word.  However,
where a font change requires that you specify a font number, an
underline is just an underline and has no parameter for you to
specify.  Also, it is assumed that the text justifier's commands for
starting and ending underlines are distinguishable, whereas you can't
tell from a font change whether it is "starting" something or "ending"
something.  M-_ differs slightly from M-# in a way that results from
these facts.

Indexentry:numeric arguments
  M-_ with no argument creates an underline around the previous word
if there is none.  If there is an underline there, it is extended one
word forward.  Thus, you can insert an underlined word by typing the
word and then a M-_.  Or you can underline several existing words by
moving past the first of them, and typing one M-_ for each word.

  M-_ given in the vicinity of an underline-begin will move @xxii[it]
forward.  Thus, it should be thought of as applying to any boundary,
where underlining either starts or stops, and moving it forward.  If a
begin underlining is moved past an end, or vice versa, they both

  Giving M-_ an argument merely tells it to apply to several words at
once instead of one.  M-_ with a positive argument of n underlines the
next n words, either creating an underlined area or extending an
existing one.  With a negative argument, that many previous words are
underlined.  Thus, M-_ can do more things with underlines than M-# can
do with font changes, because of the facts that you don't need to use
the argument to say which font, and you can tell a beginning from an

Indexentry:C-X _,region
  For larger scale operations, you can use C-X _ to place underlines
from point to mark, or C-X _ with a negative argument to remove all
underlining between point and mark.

indexentry:Underline Begin,Underline End
  By default, ^B is used to begin an underline and ^E is used to end
one.  The variables QUnderline Begin and QUnderline End may be
created and set to strings to use instead.  For a single character you
can use the numeric ASCII code for it.}{-TRUTH: End +ITS}

EMACS  Node: Paging, Previous: Text, Up: Top, Next: Narrowing

Chapter:Commands for Manipulating Pages

	C-M-L		Insert formfeed.
	C-X C-P		Put point and mark around this page
			(or another page).
	C-X [		Move point to previous page boundary.
	C-X ]		Move point to next page boundary.
	C-X P		Narrow down to just this (or next) page.
	C-X L		Count the lines in this page.

  Most editors make the division of a file into pages extremely
important.  The page separators have fundamental effects on the
editors' behavior.  EMACS, on the other hand, treats a formfeed
character just like any other character.  It can be inserted or
deleted in the ordinary way (but, for convenience, C-M-L inserts a
formfeed).  Thus, you are free to paginate your file, or not,
according to other criteria.  However, since pages are often
meaningful divisions of the file, commands are provided to work on

Indexentry:C-X [,C-X ],motion
{+INFO:  Also *Note PAGE: PAGE, for a description of the PAGE library,
which has extensions for making it convenient to edit viewing only one
page at a time.

}  The C-X [ (^R Previous Page) command moves point to the previous
page delimiter (actually, to right after it).  If point starts out
right after a page delimiter, it skips that one and stops at the
previous one.  A numeric argument serves as a repeat count.
The C-X ] (^R Next Page) command moves past the next page delimiter.

Indexentry:C-X C-P,mark,region,C-W
  The C-X C-P command (^R Mark Page) puts point at the beginning of
the current page and the mark at the end.  The page terminator at the
end is included (the mark follows it).  That at the front is excluded
(point follows it).  Thus, this command can be followed by a C-W to
kill a page which is to be moved elsewhere.  Or, it can be used just
to go to the top of the page.

  A numeric argument to C-X C-P is used to specify which page to go
to, relative to the current one (The design of TECO is such that it is
not possible to know the absolute number of the page you are in,
except by scanning the whole file for formfeeds).  Zero means the
current page.  One means the next page, and -1 means the previous one.

Indexentry:C-X P,narrowing,C-X W
  The command C-X P (^R Set Bounds Page) narrows down to just one
page.  Everything before and after becomes temporarily invisible and
inaccessible{+INFO: (*Note Narrow: Narrowing.)}.  Use C-X W to undo this.
Both page terminators, the preceding one and the following one, are
excluded from the visible region.  Like C-X C-P, the C-X P command
normally selects the current page, but allows you to specify which
page explicitly relative to the current one with a numeric argument.
However, when you are already narrowed down to one page, C-X P moves
you to the next page (otherwise, it would be a useless no-op).  One
effect of this quirk is that several C-X P's in a row get first the
current page and then successive pages.

Indexentry:Page Delimiter
  Just what delimits pages is controlled by the variable Page
Delimiter, which should contain a TECO search string which will find a
page separator.  Normally, it contains a string containing just ^L.
For this file, it contains{+INFO: (*Note Locals: Locals.)} ^_^L^O^_, which
means that either a ^_^L or just a ^_ (ie, whatever separates INFO
nodes) should be a page separator.  In any case, page separators are
recognized as such only at the beginning of a line.  The paragraph
commands consider each page boundary to delimit paragraphs as well.

indexentry:C-X L
  The C-X L command (^R Count Lines Page) is good for deciding where
to break a page in two.  It first prints (in the echo area) the total
number of lines in the current page, and then divides it up into those
preceding the current line and those following, as in "96 (72+25)".
Notice that the sum is off by one;  that will happen whenever point is
not at the front of a line.

EMACS  Node: PAGE, Previous: Paging, Up: Paging

Section:Editing Only One Page at a Time
indexentry:pages,libraries,PAGE,mode line

  The PAGE library is meant to allow the handling of Pages as
discrete, often independent units, letting you see only one page at a
time, and providing commands to move between pages, split pages and
join pages.  It contrives to show the number of the page you are
looking at in the mode line.  You can also ask to see a "directory" of
the pages in the file, or to insert it into the file.  This is an
extension of and replacement for the facility provided by the C-X P
command in standard EMACS.  It is an optional library because we do
not think it is necessarily an improvement.

  The commands in the PAGE library supplant and redefine commands in
standard EMACS.  Therefore, you cannot use them unless you give the
command M-X Load LibraryPAGE<cr> explicitly.

	C-X ]		move to next page
	C-X [		move to previous page
	C-X C-P		move to page by absolute number
	C-X P		split this page at point
	C-X J		join this page to the next or previous one
	C-X W		see the whole file again

Indexentry:C-X C-P
  The most fundamental thing to do with PAGE is to go to a specific
page.  This can be done by giving the page number as an argument to
C-X C-P (^R Goto Page).  If you give a number too big, the last page
in the file will be selected.

  For convenience, C-X C-P with no argument when you are looking at
the whole file selects the page containing point.  When you are
looking at only one page, C-X C-P with no argument goes to the next
page and with a negative argument goes to the previous page.

Indexentry:C-X [,C-X ]
  However, the main commands for moving forward or backward by pages
are C-X [ and C-X ] (^R Goto Previous Page and ^R Goto Next Page).
These take a numeric argument (either sign) and move that many pages.

indexentry:C-X W
  When you want to go back to viewing the whole file instead of just
one page, you can use the C-X W (^R Widen Bounds) command.  These are
the same characters that you would use in standard EMACS, but they run
a different function that knows to remove the page number from the
mode line.

  The C-S (^R Incremental Search) and C-R (^R Reverse Search) are
redefined to widen bounds first and narrow them again afterwards.  So
you can search through the whole file, but afterward again see only
one page.  In fact, PAGE goes through some trouble to work with
whatever search functions you prefer to use, and find them wherever
you put them.

indexentry:C-X P,C-X J,split pages,join pages
  To split an existing page, you could insert a ^L, but unless you do
this while seeing the whole file, PAGE might get confused for a while.
A way that is less tricky is to use C-X P (^R Insert Pagemark) which
inserts the right things, selects the second of the two pages formed
from the old page, and guarantees that things will be consistent.  To
get rid of a page mark without worry, use C-X J (^R Join Next Page).
It gets rid of the page mark after the current page; or, with a
negative argument, gets rid of the page mark before this page.

indexentry:PAGE Flush CRLF
  A pagemark is defined as <crlf>^L.  if you set QPAGE Flush CRLF
to 1, a pagemark will be <crlf>^L<crlf>, which will have the effect of
making the CRLF at the beginning of each page invisible.  This may be
desirable for EMACS library source files.

indexentry:comments,View Page Directory,Insert Page Directory
  To see a list of all the pages in the file, each one represented by
its first nonempty line, use M-X View Page Directory.  It prints out
the first non-blank line on each page, preceded by its page number.
M-X Insert Page Directory inserts the same directory into the buffer
at point.  If you give it an argument, it tries to make the whole
thing into a comment by putting the Comment Start string at the front
of each line and the Comment End string at the end.

  PAGE will use the value of QPage Setup Hook as the function for
placing its commands on keys, if you supply a value for it.

EMACS  Node: Narrowing, Previous: Paging, Up: Top, Next: Minibuffer


	C-X N	Narrow down to between point and mark.
	C-X W	Widen to view the entire buffer.
	C-X P	Narrow down to the page point is in.

  "Narrowing" means focusing in on some portion of the buffer, making
the rest temporarily invisible and inaccessible.

  When you have narrowed down to a part of the buffer, that part
appears to be all there is.  You can't see the rest, you can't move
into it (motion commands won't go outside the visible part), you can't
change it in any way.  However, it is not gone, and if you save the
file you are editing all the invisible text will be saved.  In
addition to sometimes making it easier to concentrate on a single
subroutine or paragraph by eliminating clutter, narrowing can be used
to restrict the range of operation of a replace command.

indexentry:C-X N,region
  The primary narrowing command is C-X N (^R Set Bounds Region).  It
sets the "virtual buffer boundaries" at point and the mark, so that
only what was between them remains visible.  Point moves to the top of
the now-visible range, and the mark is left at the end, so that the
region marked is unchanged.

indexentry:C-X W
  The way to undo narrowing is to widen with C-X W (^R Set Bounds
Full).  This makes all text in the buffer accessible again.

  Another way to narrow is to narrow to just one page, with C-X P (^R
Set Bounds Page).{+INFO:  *Note Paging: Paging.}

  Note that the virtual buffer boundaries are a powerful TECO
mechanism used internally in EMACS in many ways.  While only the
commands described here set them permanently, many others set them

EMACS  Node: Minibuffer, Previous: Narrowing, Up: Top, Next: KBDMAC

Chapter:The Minibuffer

  The minibuffer is a facility by means of which EMACS commands can
read input from the terminal, allowing you to use EMACS commands to
edit the input while you are typing it.  The minibuffer also allows
the EMACS user to type in a TECO program and execute it. 

indexentry:mode line
  You can always tell when you are in a minibuffer, because the Mode
line will contain something in parentheses, such as "(Minibuffer)" or
"(Query Replace)".  There will also be a line of dashes across the
screen a few lines from the top.  Strictly speaking, the minibuffer is
actually the lines above the line of dashes, for that is where you
edit the input that the minibuffer is asking you for.  The editing
region has been limited to a few lines so that most of the screen can
continue to show the file you are editing.

indexentry:M-%,Query Replace
  Often, a minibuffer will start out with some text in it.  This means
that you are supposed to add to that text, or, sometimes, to delete
some of it so as to choose among several alternatives.  For example,
Meta-% (^R Query Replace) provides you with a minibuffer initially
containing the string "MM Query Replace".  The cursor comes at the
end.  You are then supposed to add in the arguments to the Query
Replace.  MM @@ TECO needs to know how you want it to output your
listing, so it offers you a minibuffer containing three lines, each of
which will output the listing in one way, and asks you to delete the
lines you don't want.

  In a minibuffer, you can edit your input until you are satisfied
with it.  When that happens, you have to tell EMACS that you are
finished.  You do that by typing two Altmodes.  An Altmode not
followed by another Altmode is simply inserted in the buffer.  This is
because it is common to want to put Altmodes into the minibuffer,
which usually contains a string of TECO commands.  For example, in
Meta-% (^R Query Replace) each argument must be ended by an Altmode.
The two Altmodes you use to exit are automatically moved to the end,
since Altmodes are so often needed there.

  Since Altmode is self-inserting, typing Meta characters can be a
problem.  You can do it by using C-\ instead of Altmode as the
Meta-prefix.  If you type a Control-Meta character on your keyboard,
the corresponding ASCII control character is inserted in the
minibuffer.  This is because the Lisp commands are rarely useful when
editing TECO code, but insertion of control characters is frequent.
If you really want to use a Control-Meta EMACS command, you must use
C-C to type it.

  You can cancel your input in a minibuffer and start all over again
by typing C-G.  That will kill all the text in the minibuffer.  A C-G
typed when the minibuffer is already empty will exit from the
minibuffer.  Usually, this will abort whatever command was using the
minibuffer, so it will return without doing anything more.  For
example, if you type two C-G's at Meta-%'s minibuffer, you will return
to top level and no Query Replace will be done.  Typing a single C-G at
a preinitialized minibuffer to empty the buffer is not very useful,
since you would have to retype all the initial text.

  If you want to type in a TECO command, you can invoke the minibuffer
with the EMACS command Meta-Altmode, or Altmode Altmode (^R Execute
Minibuffer).  An empty minibuffer will appear, into which you should
type the TECO command string.  When you exit with Altmode Altmode, the
two Altmodes that you exit with will be moved to the end of the
command string, so if you wanted an Altmode where the cursor was you
should have inserted one with a C-Q Altmode.  Then the command string
will be executed, in the environment from which the minibuffer was

indexentry:C-X Altmode,confirmation
  The last five distinct minibuffer commands you have issued are
remembered in a ring buffer in q-register .M.  (M-X commands are also
remembered there).  The C-X Altmode command (^R Re-execute Minibuffer)
will re-execute the last command (minibuffer or M-X) in the ring.
With an argument <n>, it will execute the <n>'th previous command.
The command is printed out (only the first 40 characters or so) and
you are asked to confirm with "Y" or "N".

Indexentry:numeric arguments,C-C C-Y
  You can also get your previous minibuffer and M-X commands back into
the minibuffer to be edited and re-executed with changes.  Giving
M-Altmode and argument, as in C-U M-Altmode, causes the minibuffer to
be loaded up with the most recent previous command, just as if you had
typed it in again from scratch.  You can then edit it, execute it by
typing two Altmodes, or cancel it with C-G.  To get an earlier command
string instead of the most recent one, use the command C-C C-Y once
you are in the minibuffer.  This command will "rotate" the ring of
saved commands much as M-Y rotates the ring of killed text.  Each C-C
C-Y will reveal an earlier command string, until the ring has rotated
all the way around and the most recent one reappears.  C-C C-Y is
actually a way of saying C-M-Y, but in the minibuffer that's the only
way to type it, since Altmode inserts itself and Control-Meta
characters insert control characters.

  If you exit from Meta-Altmode with a C-G, nothing is executed and the
previous minibuffered command string is still remembered as the last

indexentry:C-X ^
  While in a minibuffer, if you decide you want the minibuffer to use
more lines on the screen, you can use C-X ^ (^R Grow Window) to get
more.  It gets one more line, or as many lines as its argument says.

EMACS  Node: KBDMAC, Previous: Minibuffer, Up: Top, Next: PICTUR

Chapter:Keyboard Macros
indexentry:keyboard macros

  A keyboard macro is a command defined by the user to abbreviate a
sequence of other commands.  If you discover that you are about to
type C-N C-D forty times, you could define a keyboard macro to do C-N
C-D and call it with a repeat count of forty.

  Keyboard macros differ from ordinary EMACS commands, in that they
are written in the EMACS command language rather than in TECO.  This
makes it easier for the novice to write them, and makes them more
convenient as temporary hacks.  However, the EMACS command language is
not powerful enough as a programming language to be useful for writing
anything intelligent or general.  For such things, TECO must be used.

  You define a keyboard macro while executing the commands which are
the definition.  Put differently, as you are defining a keyboard
macro, the definition is being executed for the first time.  This way,
you can see what the effects of your commands are, so that you don't
have to figure them out in your head.  When you are finished, the
keyboard macro is defined and also has been, in effect, executed once.
You can then do the whole thing over again by invoking the macro.

Indexentry:C-X (,C-X ),C-X E,^R Start Kbd Macro,^R End Kbd Macro
Indexentry:^R Execute Kbd Macro
  To start defining a keyboard macro, type the C-X ( command (^R Start
Kbd Macro).  From then on, your commands continue to be executed, but
also become part of the definition of the macro.  "Def" will appear in
the mode line to remind you of what is going on.  When you are
finished, the C-X ) command (^R End Kbd Macro) terminates the
definition (without becoming part of it!).  The macro thus defined can
be invoked again with the C-X E command (^R Execute Kbd Macro), which
may be given a repeat count as a numeric argument to execute the macro
many times.  An argument of zero means to repeat the macro
indefinitely (until it gets an error).  C-X ) can also be given a
repeat count as an argument, in which case it re-invokes the macro,
but defining the macro counts as one repetition (since it is executed
as you define it).  So, giving C-X ) an argument of 2 would execute
the macro one additional time.

Indexentry:Name Kbd Macro
  If you wish to save a keyboard macro for longer than until you
define the next one, you must give it a name.  Do M-X Name Kbd
MacroFOO<cr> and the last keyboard macro defined -- the one which C-X
E would invoke -- is turned into a function and given the name FOO.
M-X FOO will from then on invoke that particular macro.  Name Kbd
Macro will also read a character from the keyboard and redefine that
character command to invoke the macro.  If you don't want to redefine
a command, type a Return or Rubout.  Only self-inserting and undefined
characters, and those that are already keyboard macros, can be
redefined in this way.  Prefix characters may be used in specifying
the command to be redefined.

indexentry:View Kbd Macro
  To examine the definition of a keyboard macro, use the function View
Kbd Macro.  Either supply the name of the function which runs the
macro, as a string argument, or type the command which invokes the
macro, on the terminal when View Kbd Macro asks for it.

Indexentry:C-X Q
  If you want to be allowed to do arbitrary editing at a certain point
each time around the macro (different each time, and not remembered as
part of the macro), you can use the C-U C-X Q command (^R Kbd Macro
Query).  When you are defining the macro, this will let you do some
editing, which will @xxii[not] become part of the macro.  When you are done,
exit with C-M-C.  This will return you to defining the macro.  When
you execute the macro, at that same point, you will again be allowed
to do some editing.  When you exit this time with C-M-C, the execution
of the macro will resume.  If you abort the recursive editing level
with C-], you will abort the macro definition or execution.

Indexentry:Query Replace,Space,Rubout,C-L,C-R,Altmode
  You can get the effect of Query Replace, where the macro asks you
each time around whether to make a change, by using the command C-X Q
with no argument in your keyboard macro.  When you are defining
the macro, the C-X Q does nothing, but when the macro is invoked the
C-X Q reads a character from the terminal to decide whether to
continue.  The special answers are Space, Rubout, Altmode, C-L, C-R.
A Space means to continue.  A Rubout means to skip the
remainder of this repetition of the macro, starting again from the
beginning in the next repetition.  An Altmode ends all repetitions of
the macro, but only the innermost macro (in case it was called from
another macro).  C-L clears the screen and asks you again for a
character to say what to do.  C-R enters a recursive editing level;
when you exit, you are asked again (if you type a space, the macro
will continue from wherever you left things when you exited the C-R).
Anything else exits all levels of keyboard macros and is reread as a

EMACS  Node: PICTUR, Previous: KBDMAC, Up: Top, Next: Sort

Chapter:The PICTUR Subsystem:  an Editor for Text Pictures
Indexentry:pictures,Edit Picture

  If you want to create a picture made out of text characters (for
example, a picture of the division of a register into fields, as a
comment in a program), the PICTUR package can make it easier.

  Do M-X Load LibPICTUR<cr>, and then M-X Edit Picture is available.
Do M-X Edit Picture with point and mark surrounding the picture to be
edited.  Edit Picture enters a recursive editing level (which you exit
with C-C C-C, as usual) in which certain commands are redefined to
make picture editing more convenient.

  While you are inside Edit Picture, all the lines of the picture are
padded out to the margin with spaces.  This makes two-dimensional
motion very convenient; C-B and C-F move horizontally, and C-N and C-P
move vertically without the inaccuracy of a ragged right margin.  When
you exit from Edit Picture, any spaces which are superfluous are
removed.  Nothing stops you from moving outside the bounds of the
picture, but if you make any changes there you will screw up the
removal of spaces when you exit (not grossly, but some lines may fail
to have their spaces removed).

  Edit Picture makes alteration of the picture convenient by
redefining the way printing characters and rubout work.  Printing
characters are defined to replace (overwrite) rather than inserting
themselves.  Rubout is defined to undo a printing character:  it
replaces the previous character with a space, and moves back to it.

  Return is defined to move to the beginning of the next line.  This
makes it usable for moving to the next apparently blank (but actually
filled with nothing but spaces) line, just as you could use Return
normally with lines that are really empty.

  Tab is redefined to indent (by moving over spaces, not inserting
them) to under the first non-space on the previous line.  Linefeed is
as usual equivalent to Return followed by Tab.

  C-O is made to create new blank lines after point, as usual, but
they are created full of spaces, as is appropriate for Edit Picture.

Indexentry:Up Picture Movement,Down Picture Movement
indexentry:Left Picture Movement,Right Picture Movement
  Four movement-control commands exist to aid in drawing vertical or
horizontal lines: If you give the command M-X Up Picture Movement,
each character you type thereafter will cause the cursor to move up
instead of to the right.  Thus if you want to draw a line of dashes up
to some point, you can give the command Up Picture Movement, type
enough dashes to make the line, and then give the command Right
Picture Movement to put things back to normal.  Similarly, there are
functions to cause downward and leftward movement: Down Picture
Movement and Left Picture Movement.  When you exit Edit Picture's
recursive editing level mode, the cursor movement control will go back
to being whatever it was before you the Edit Picture function.  (One
final note: you can use these cursor movement commands outside of Edit
Picture too, even when not in overwrite mode.  You have to be somewhat
careful though.)

  Possible future extensions include alteration of the kill and
un-kill commands to replace instead of deleting and inserting, and to
handle rectangles if two corners are specified using point and the

EMACS  Node: Sort, Previous: PICTUR, Up: Top{+Twenex:, Next: Misc}

Chapter:Sorting Functions

  The SORT library contains functions to sort the region either
line by line, paragraph by paragraph or page by page.  Paragraphs are
defined in the same way as for the paragraph-motion functions
{+INFO:(*Note Paragraph: Sentences.) }and pages are defined as for the page
motion commands{+INFO: (*Note Paging: Paging.)}.  All of these functions can be
undone by the Undo command{+INFO: (*Note Undo: Undo.)}.  They take no arguments.

indexentry:Sort Lines,Sort Paragraphs,Sort Pages
  The names of the functions are M-X Sort Lines, M-X Sort Paragraphs,
and M-X Sort Pages.

  What more is there to say?
EMACS  Node: Misc, Previous: Sort, Up: Top

Chapter:Miscellaneous Functions
Indexentry:Push to EXEC,inferiors,forks,Exec Name,Check Mail,Mail
Indexentry:Read Mail,Mail Reader,MM (mail reader),TECO

  M-X Push to EXEC forks up a copy of the system command language and
puts you in the new fork.  You can return to EMACS via POP.  The fork
is maintained so that the next invocation of M-X Push to EXEC gets you
the EXEC you left in the last call.  The variable QExec name
contains the name of the file to run -- 0 means the ordinary EXEC.

  M-X Check Mail checks to see if you have any new mail.
M-X Mail or M-X Read Mail runs the program specified by QMail Reader
which defaults to the program "MM" (no relation to EMACS "MM"
commands).  On subsequent calls the fork is continued rather than
restarted.  A numeric argument means kill the mail reader fork instead
of running it.

  These use the TECO command FZ, which can be used in general for
running any program as an inferior fork under TECO.
}{-TRUTH:End +Twenex}

Tag Table:
this is just a dummy.  TAGS will fill in the real stuff.
 End Tag Table:
Local Modes::
Paragraph Delimiter:	 :
Page Delimiter:}