Merge from emacs-23
[bpt/emacs.git] / doc / emacs / text.texi
index 1c4a506..75fcc86 100644 (file)
@@ -1,60 +1,47 @@
 @c This is part of the Emacs manual.
 @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001,
-@c   2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+@c   2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+@c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Text, Programs, Indentation, Top
 @chapter Commands for Human Languages
 @cindex text
 @cindex manipulating text
 
-  The term @dfn{text} has two widespread meanings in our area of the
-computer field.  One is data that is a sequence of characters.  Any file
-that you edit with Emacs is text, in this sense of the word.  The other
-meaning is more restrictive: a sequence of characters in a human language
-for humans to read (possibly after processing by a text formatter), as
-opposed to a program or binary data.  This chapter is concerned with
-editing text in the narrower sense.
-
-  Human languages have syntactic/stylistic conventions that can be
-supported or used to advantage by editor commands: conventions involving
-words, sentences, paragraphs, and capital letters.  This chapter
-describes Emacs commands for all of these things.  There are also
-commands for @dfn{filling}, which means rearranging the lines of a
-paragraph to be approximately equal in length.  The commands for moving
-over and killing words, sentences and paragraphs, while intended
-primarily for editing text, are also often useful for editing programs.
-
-  Emacs has several major modes for editing human-language text.  If the
-file contains text pure and simple, use Text mode, which customizes
-Emacs in small ways for the syntactic conventions of text.  Outline mode
+  This chapter describes Emacs commands that act on @dfn{text}, by
+which we mean sequences of characters in a human language (as opposed
+to, say, a computer programming language).  These commands act in ways
+that take into account the syntactic and stylistic conventions of
+human languages: conventions involving words, sentences, paragraphs,
+and capital letters.  There are also commands for @dfn{filling}, which
+means rearranging the lines of a paragraph to be approximately equal
+in length.  These commands, while intended primarily for editing text,
+are also often useful for editing programs.
+
+  Emacs has several major modes for editing human-language text.  If
+the file contains ordinary text, use Text mode, which customizes Emacs
+in small ways for the syntactic conventions of text.  Outline mode
 provides special commands for operating on text with an outline
 structure.
 @iftex
 @xref{Outline Mode}.
 @end iftex
 
-  For text which contains embedded commands for text formatters, Emacs
-has other major modes, each for a particular formatter.  Thus, for
-input to @TeX{}, you would use @TeX{}
-@iftex
-mode (@pxref{TeX Mode,,@TeX{} Mode}).
-@end iftex
-@ifnottex
-mode.
-@end ifnottex
-For input to groff or nroff, use Nroff mode.
-
-  Instead of using a text formatter, you can edit formatted text in
-WYSIWYG style (``what you see is what you get''), with Enriched mode.
-Then the formatting appears on the screen in Emacs while you edit.
-@iftex
-@xref{Formatted Text}.
-@end iftex
+@cindex nXML mode
+@cindex mode, XML
+@cindex mode, nXML
+@findex nxml-mode
+  Emacs has other major modes for text which contains ``embedded''
+commands, such as @TeX{} and La@TeX{} (@pxref{TeX Mode}); HTML and
+SGML (@pxref{HTML Mode}); XML (@pxref{Top, nXML Mode,,nxml-mode, nXML
+Mode}); and Groff and Nroff (@pxref{Nroff Mode}).  In addition, you
+can edit formatted text in WYSIWYG style (``what you see is what you
+get''), using Enriched mode (@pxref{Formatted Text}).
 
 @cindex ASCII art
   If you need to edit pictures made out of text characters (commonly
-referred to as ``ASCII art''), use @kbd{M-x edit-picture} to enter
-Picture mode, a special major mode for editing such pictures.
+referred to as ``ASCII art''), use Picture mode, a special major mode
+for editing such pictures.
 @iftex
 @xref{Picture Mode,,, emacs-xtra, Specialized Emacs Features}.
 @end iftex
@@ -71,17 +58,17 @@ Picture mode, a special major mode for editing such pictures.
 @inforef{Top,, autotype}.
 
 @menu
-* Words::              Moving over and killing words.
-* Sentences::          Moving over and killing sentences.
-* Paragraphs::         Moving over paragraphs.
-* Pages::              Moving over pages.
-* Filling::            Filling or justifying text.
-* Case::               Changing the case of text.
-* Text Mode::          The major modes for editing text files.
+* Words::               Moving over and killing words.
+* Sentences::           Moving over and killing sentences.
+* Paragraphs::          Moving over paragraphs.
+* Pages::               Moving over pages.
+* Filling::             Filling or justifying text.
+* Case::                Changing the case of text.
+* Text Mode::           The major modes for editing text files.
 * Outline Mode::        Editing outlines.
-* TeX Mode::           Editing input to the formatter TeX.
-* HTML Mode::           Editing HTML, SGML, and XML files.
-* Nroff Mode::         Editing input to the formatter nroff.
+* TeX Mode::            Editing input to the formatter TeX.
+* HTML Mode::           Editing HTML and SGML files.
+* Nroff Mode::          Editing input to the formatter nroff.
 * Formatted Text::      Editing formatted text directly in WYSIWYG fashion.
 * Text Based Tables::   Editing text-based tables in WYSIWYG fashion.
 @end menu
@@ -120,24 +107,24 @@ cognate to @kbd{C-@@}, which is an alias for @kbd{C-@key{SPC}}.
 @findex backward-word
   The commands @kbd{M-f} (@code{forward-word}) and @kbd{M-b}
 (@code{backward-word}) move forward and backward over words.  These
-Meta characters are thus analogous to the corresponding control
-characters, @kbd{C-f} and @kbd{C-b}, which move over single characters
-in the text.  The analogy extends to numeric arguments, which serve as
-repeat counts.  @kbd{M-f} with a negative argument moves backward, and
-@kbd{M-b} with a negative argument moves forward.  Forward motion
-stops right after the last letter of the word, while backward motion
-stops right before the first letter.
+@key{Meta}-based key sequences are analogous to the key sequences
+@kbd{C-f} and @kbd{C-b}, which move over single characters.  The
+analogy extends to numeric arguments, which serve as repeat counts.
+@kbd{M-f} with a negative argument moves backward, and @kbd{M-b} with
+a negative argument moves forward.  Forward motion stops right after
+the last letter of the word, while backward motion stops right before
+the first letter.
 
 @kindex M-d
 @findex kill-word
   @kbd{M-d} (@code{kill-word}) kills the word after point.  To be
 precise, it kills everything from point to the place @kbd{M-f} would
 move to.  Thus, if point is in the middle of a word, @kbd{M-d} kills
-just the part after point.  If some punctuation comes between point and the
-next word, it is killed along with the word.  (If you wish to kill only the
-next word but not the punctuation before it, simply do @kbd{M-f} to get
-the end, and kill the word backwards with @kbd{M-@key{DEL}}.)
-@kbd{M-d} takes arguments just like @kbd{M-f}.
+just the part after point.  If some punctuation comes between point
+and the next word, it is killed along with the word.  (If you wish to
+kill only the next word but not the punctuation before it, simply do
+@kbd{M-f} to get the end, and kill the word backwards with
+@kbd{M-@key{DEL}}.)  @kbd{M-d} takes arguments just like @kbd{M-f}.
 
 @findex backward-kill-word
 @kindex M-DEL
@@ -160,12 +147,13 @@ more on transposition.
 
 @kindex M-@@
 @findex mark-word
-  To operate on the next @var{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 @kbd{M-@@} (@code{mark-word})
-which does not move point, but sets the mark where @kbd{M-f} would move
-to.  @kbd{M-@@} accepts a numeric argument that says how many words to
-scan for the place to put the mark.
+  To operate on the next @var{n} words with an operation which acts on
+the region, use the command @kbd{M-@@} (@code{mark-word}).  This
+command does not move point, but sets the mark where @kbd{M-f} would
+move to.  Once the mark is active, each additional @kbd{M-@@} advances
+the mark by one additional word.  @kbd{M-@@} also accepts a numeric
+argument that says how many words to scan for the place to put the
+mark.
 
   The word commands' understanding of word boundaries is controlled
 by the syntax table.  Any character can, for example, be declared to
@@ -207,18 +195,18 @@ punctuation that ends the sentence.  Neither one moves over the
 whitespace at the sentence boundary.
 
 @kindex M-k
-@kindex C-x DEL
 @findex kill-sentence
+  Just as @kbd{C-a} and @kbd{C-e} have a kill command, @kbd{C-k}, to
+go with them, @kbd{M-a} and @kbd{M-e} have a corresponding kill
+command: @kbd{M-k} (@code{kill-sentence}) kills from point to the end
+of the sentence.  With a positive numeric argument @var{n}, it kills
+the next @var{n} sentences; with a negative argument @minus{}@var{n},
+it kills back to the beginning of the @var{n}th preceding sentence.
+
+@kindex C-x DEL
 @findex backward-kill-sentence
-  Just as @kbd{C-a} and @kbd{C-e} have a kill command, @kbd{C-k}, to go
-with them, so @kbd{M-a} and @kbd{M-e} have a corresponding kill command
-@kbd{M-k} (@code{kill-sentence}) which kills from point to the end of
-the sentence.  With minus one as an argument it kills back to the
-beginning of the sentence.  Larger arguments serve as a repeat count.
-There is also a command, @kbd{C-x @key{DEL}}
-(@code{backward-kill-sentence}), for killing back to the beginning of a
-sentence.  This command is useful when you change your mind in the
-middle of composing text.
+  The @kbd{C-x @key{DEL}} (@code{backward-kill-sentence}) kills back
+to the beginning of a sentence.
 
   The sentence commands assume that you follow the American typist's
 convention of putting two spaces at the end of a sentence; they consider
@@ -234,7 +222,7 @@ too.  These commands do not stop for periods that indicate abbreviations.
 @vindex sentence-end-double-space
   If you want to use just one space between sentences, you can set the
 variable @code{sentence-end-double-space} to @code{nil} to make the
-sentence commands stop for single spaces.  However, this mode has a
+sentence commands stop for single spaces.  However, this has a
 drawback: there is no way to distinguish between periods that end
 sentences and those that indicate abbreviations.  For convenient and
 reliable editing, we therefore recommend you follow the two-space
@@ -243,13 +231,12 @@ affects filling (@pxref{Fill Commands}) in related ways.
 
 @vindex sentence-end
   The variable @code{sentence-end} controls how to recognize the end
-of a sentence.  If non-@code{nil}, it is a regexp that matches the
-last few characters of a sentence, together with the whitespace
-following the sentence.  If the value is @code{nil}, the default, then
-Emacs computes the regexp according to various criteria such as the
-value of @code{sentence-end-double-space}.  @xref{Regexp Example}, for
-a detailed explanation of one of the regular expressions Emacs uses
-for this purpose.
+of a sentence.  If non-@code{nil}, its value should be a regular
+expression, which is used to match the last few characters of a
+sentence, together with the whitespace following the sentence
+(@pxref{Regexps}).  If the value is @code{nil}, the default, then
+Emacs computes sentence ends according to various criteria such as the
+value of @code{sentence-end-double-space}.
 
 @vindex sentence-end-without-period
   Some languages do not use periods to indicate the end of a sentence.
@@ -297,17 +284,17 @@ all lines which don't start with the fill prefix.  @xref{Filling}.
 
 @kindex M-h
 @findex mark-paragraph
-  When you wish to operate on a paragraph, you can type @kbd{M-h}
-(@code{mark-paragraph}) to set the region around it.  Thus, for
-example, @kbd{M-h C-w} kills the paragraph around or after point.
-@kbd{M-h} puts point at the beginning and mark at the end of the
-paragraph point was in.  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.  If there are blank lines preceding the
-first line of the paragraph, one of these blank lines is included in
-the region.  If the region is already active, the command sets the
-mark without changing point; furthermore, each subsequent @kbd{M-h}
-further advances the mark by one paragraph.
+  When you wish to operate on a paragraph, type @kbd{M-h}
+(@code{mark-paragraph}) to set the region around it.  For example,
+@kbd{M-h C-w} kills the paragraph around or after point.  @kbd{M-h}
+puts point at the beginning and mark at the end of the paragraph point
+was in.  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.  If there are blank lines preceding the first line of the
+paragraph, one of these blank lines is included in the region.  If the
+region is already active, the command sets the mark without changing
+point; furthermore, each subsequent @kbd{M-h} further advances the
+mark by one paragraph.
 
 @vindex paragraph-start
 @vindex paragraph-separate
@@ -332,15 +319,15 @@ pages.
 @section Pages
 
 @cindex pages
-@cindex formfeed
-  Files are often thought of as divided into @dfn{pages} by the
-@dfn{formfeed} character (@acronym{ASCII} control-L, octal code 014).
-When you print hardcopy for a file, this character forces a page break;
-thus, each page of the file goes on a separate page on paper.  Most Emacs
-commands treat the page-separator character just like any other
-character: you can insert it with @kbd{C-q C-l}, and delete it with
-@key{DEL}.  Thus, you are free to paginate your file or not.  However,
-since pages are often meaningful divisions of the file, Emacs provides
+@cindex formfeed character
+  Within some text files, text is divided into @dfn{pages}, which are
+delimited by the @dfn{formfeed character} (@acronym{ASCII} code 12,
+sometimes denoted as @key{control-L}).  When you print hardcopy for a
+file, the formfeed character forces a page break: each page of the
+file goes on a separate page on paper.  Most Emacs commands treat the
+formfeed character just like any other character: you can insert it
+with @kbd{C-q C-l}, and delete it with @key{DEL}.  However, since
+pages are often meaningful divisions of the file, Emacs provides
 commands to move over them and operate on them.
 
 @table @kbd
@@ -377,8 +364,8 @@ elsewhere.  If you move to another page delimiter with @kbd{C-x [} and
 delimited once again.  The reason @kbd{C-x C-p} includes only the
 following page delimiter in the region is to ensure that.
 
-  A numeric argument to @kbd{C-x C-p} is used to specify which page to go
-to, relative to the current one.  Zero means the current page.  One means
+  A numeric argument to @kbd{C-x C-p} specifies which page to go to,
+relative to the current one.  Zero means the current page.  One means
 the next page, and @minus{}1 means the previous one.
 
 @kindex C-x l
@@ -398,9 +385,10 @@ beginning of a line.
 
 @vindex page-delimiter
   The variable @code{page-delimiter} controls where pages begin.  Its
-value is a regexp that matches the beginning of a line that separates
-pages.  The normal value of this variable is @code{"^\f"}, which
-matches a formfeed character at the beginning of a line.
+value is a regular expression that matches the beginning of a line
+that separates pages (@pxref{Regexps}).  The normal value of this
+variable is @code{"^\f"}, which matches a formfeed character at the
+beginning of a line.
 
 @node Filling
 @section Filling Text
@@ -415,13 +403,12 @@ a style of filling for each portion of the text (@pxref{Formatted
 Text}).
 
 @menu
-* Auto Fill::          Auto Fill mode breaks long lines automatically.
-* Fill Commands::       Commands to refill paragraphs and center lines.
-* Fill Prefix::                Filling paragraphs that are indented
-                          or in a comment, etc.
-* Adaptive Fill::       How Emacs can determine the fill prefix automatically.
-* Refill::              Keeping paragraphs filled.
-* Longlines::           Editing text with very long lines.
+* Auto Fill::      Auto Fill mode breaks long lines automatically.
+* Fill Commands::  Commands to refill paragraphs and center lines.
+* Fill Prefix::    Filling paragraphs that are indented or in a comment, etc.
+* Adaptive Fill::  How Emacs can determine the fill prefix automatically.
+* Refill::         Keeping paragraphs filled.
+* Longlines::      Editing text with very long lines.
 @end menu
 
 @node Auto Fill
@@ -493,7 +480,7 @@ Set the fill column (@code{set-fill-column}).
 Fill each paragraph in the region (@code{fill-region}).
 @item M-x fill-region-as-paragraph
 Fill the region, considering it as one paragraph.
-@item M-s
+@item M-o M-s
 Center a line.
 @end table
 
@@ -527,10 +514,10 @@ the extra spaces, use @kbd{M-q} with no argument.  (Likewise for
 other styles of filling, is with the @code{justification} text
 property; see @ref{Format Justification}.
 
-@kindex M-s @r{(Text mode)}
+@kindex M-o M-s @r{(Text mode)}
 @cindex centering
 @findex center-line
-  The command @kbd{M-s} (@code{center-line}) centers the current line
+  The command @kbd{M-o M-s} (@code{center-line}) centers the current line
 within the current fill column.  With an argument @var{n}, it centers
 @var{n} lines individually and moves past them.  This binding is
 made by Text mode and is available only in that and related modes
@@ -768,34 +755,45 @@ completely unfilled if you edit them without Longlines mode.
 @cindex word wrap
 @cindex Long Lines minor mode
 
-  Long Lines mode is a minor mode for @dfn{word wrapping}; it lets you
-edit ``unfilled'' text files, which Emacs would normally display as a
-bunch of extremely long lines.  Many text editors, such as those built
-into many web browsers, normally do word wrapping.
+  Sometimes, you may come across ``unfilled'' text files, which Emacs
+normally displays as a bunch of extremely long lines.  Comfortably
+reading and editing such files normally requires ``word wrap'', a
+feature that breaks up each long text line into multiple screen lines
+in a readable manner---by putting the breaks at word boundaries.  Many
+text editors, such as those built into many web browsers, perform word
+wrapping by default.
+
+  There are two different minor modes in Emacs that perform word
+wrapping.  The first is Visual Line mode, which does it by altering
+the behavior of screen line continuation.  @xref{Visual Line Mode},
+for information about Visual Line mode.
 
 @findex longlines-mode
-  To enable Long Lines mode, type @kbd{M-x longlines-mode}.  If the
-text is full of long lines, this will ``wrap'' them
-immediately---i.e., break up to fit in the window.  As you edit the
-text, Long Lines mode automatically re-wraps lines by inserting or
-deleting @dfn{soft newlines} as necessary (@pxref{Hard and Soft
-Newlines}.)  These soft newlines won't show up when you save the
-buffer into a file, or when you copy the text into the kill ring,
-clipboard, or a register.
+  Instead of using Visual Line mode, you can use a minor mode called
+Long Lines mode.  Long Lines mode wraps lines by inserting or deleting
+@dfn{soft newlines} as you type (@pxref{Hard and Soft Newlines}).
+These soft newlines won't show up when you save the buffer into a
+file, or when you copy the text into the kill ring, clipboard, or a
+register.  Unlike Visual Line mode, Lone Lines mode breaks long lines
+at the fill column (@pxref{Fill Commands}), rather than the right
+window edge.  To enable Long Lines mode, type @kbd{M-x
+longlines-mode}.  If the text is full of long lines, this also
+immediately ``wraps'' them all.
 
 @findex longlines-auto-wrap
-  Word wrapping is @emph{not} the same as ordinary filling
-(@pxref{Fill Commands}).  It does not contract multiple spaces into a
-single space, recognize fill prefixes (@pxref{Fill Prefix}), or
-perform adaptive filling (@pxref{Adaptive Fill}).  The reason for this
-is that a wrapped line is still, conceptually, a single line.  Each
-soft newline is equivalent to exactly one space in that long line, and
-vice versa.  However, you can still call filling functions such as
-@kbd{M-q}, and these will work as expected, inserting soft newlines
-that won't show up on disk or when the text is copied.  You can even
-rely entirely on the normal fill commands by turning off automatic
-line wrapping, with @kbd{C-u M-x longlines-auto-wrap}.  To turn
-automatic line wrapping back on, type @kbd{M-x longlines-auto-wrap}.
+  The word wrap performed by Long Lines mode is @emph{not} the same as
+ordinary filling (@pxref{Fill Commands}).  It does not contract
+multiple spaces into a single space, recognize fill prefixes
+(@pxref{Fill Prefix}), or perform adaptive filling (@pxref{Adaptive
+Fill}).  The reason for this is that a wrapped line is still,
+conceptually, a single line.  Each soft newline is equivalent to
+exactly one space in that long line, and vice versa.  However, you can
+still call filling functions such as @kbd{M-q}, and these will work as
+expected, inserting soft newlines that won't show up on disk or when
+the text is copied.  You can even rely entirely on the normal fill
+commands by turning off automatic line wrapping, with @kbd{C-u M-x
+longlines-auto-wrap}.  To turn automatic line wrapping back on, type
+@kbd{M-x longlines-auto-wrap}.
 
 @findex longlines-show-hard-newlines
   Type @kbd{RET} to insert a hard newline, one which automatic
@@ -930,23 +928,10 @@ type @kbd{@key{ESC} @key{TAB}} or @kbd{C-M-i}.
 @vindex text-mode-hook
   Entering Text mode runs the hook @code{text-mode-hook}.  Other major
 modes related to Text mode also run this hook, followed by hooks of
-their own; this includes Paragraph-Indent Text mode, Nroff mode, @TeX{}
-mode, Outline mode, and Mail mode.  Hook functions on
-@code{text-mode-hook} can look at the value of @code{major-mode} to see
-which of these modes is actually being entered.  @xref{Hooks}.
-
-@ifnottex
-  Emacs provides two other modes for editing text that is to be passed
-through a text formatter to produce fancy formatted printed output.
-@xref{Nroff Mode}, for editing input to the formatter nroff.
-@xref{TeX Mode,,@TeX{} Mode}, for editing input to the formatter TeX.
-
-  Another mode is used for editing outlines.  It allows you to view the
-text at various levels of detail.  You can view either the outline
-headings alone or both headings and text; you can also hide some of the
-headings at lower levels from view to make the high level structure more
-visible.  @xref{Outline Mode}.
-@end ifnottex
+their own; this includes Paragraph-Indent Text mode, Nroff mode,
+@TeX{} mode, Outline mode, and Message mode.  Hook functions on
+@code{text-mode-hook} can look at the value of @code{major-mode} to
+see which of these modes is actually being entered.  @xref{Hooks}.
 
 @node Outline Mode
 @section Outline Mode
@@ -993,8 +978,8 @@ major mode's special commands.  (The variable
 the hook @code{outline-mode-hook} (@pxref{Hooks}).
 
 @menu
-* Format: Outline Format.         What the text of an outline looks like.
-* Motion: Outline Motion.         Special commands for moving through
+* Format: Outline Format.          What the text of an outline looks like.
+* Motion: Outline Motion.          Special commands for moving through
                                      outlines.
 * Visibility: Outline Visibility.  Commands to control what is visible.
 * Views: Outline Views.            Outlines and multiple views.
@@ -1310,7 +1295,7 @@ folds, and for showing and hiding text:
 
 @table @asis
 @item @kbd{C-M-Mouse-1} zooms in on the heading clicked on
-@itemize @asis
+@itemize @w{}
 @item
 single click: expose body.
 @item
@@ -1321,7 +1306,7 @@ triple click: expose body and subheadings.
 quad click: expose entire subtree.
 @end itemize
 @item @kbd{C-M-Mouse-2} exposes text under the heading clicked on
-@itemize @asis
+@itemize @w{}
 @item
 single click: expose body.
 @item
@@ -1332,7 +1317,7 @@ triple click: expose body and subheadings.
 quad click: expose entire subtree.
 @end itemize
 @item @kbd{C-M-Mouse-3} hides text under the heading clicked on or exits fold
-@itemize @asis
+@itemize @w{}
 @item
 single click: hide subtree.
 @item
@@ -1373,36 +1358,38 @@ automatically by putting this in your @file{.emacs} file:
 @findex latex-mode
 @findex slitex-mode
 @findex doctex-mode
-
-  @TeX{} is a powerful text formatter written by Donald Knuth; it is
-also free software, like GNU Emacs.  La@TeX{} is a simplified input
-format for @TeX{}, implemented by @TeX{} macros; it comes with @TeX{}.
-Sli@TeX{} is a special form of La@TeX{}.@footnote{Sli@TeX{} is
-obsoleted by the @samp{slides} document class and other alternative
-packages in recent La@TeX{} versions.}  Doc@TeX{} (@file{.dtx}) is a
-special file format in which the La@TeX{} sources are written,
-combining sources with documentation.
-
-  Emacs has a special @TeX{} mode for editing @TeX{} input files.
-It provides facilities for checking the balance of delimiters and for
-invoking @TeX{} on all or part of the file.
+@findex bibtex-mode
+
+  Emacs provides special major modes for editing files written in
+@TeX{} and its related formats.  @TeX{} is a powerful text formatter
+written by Donald Knuth; like GNU Emacs, it is free software.
+La@TeX{} is a simplified input format for @TeX{}, implemented using
+@TeX{} macros.  Doc@TeX{} is a special file format in which the
+La@TeX{} sources are written, combining sources with documentation.
+Sli@TeX{} is an obsolete special form of La@TeX{}.@footnote{It has
+been replaced by the @samp{slides} document class, which comes with
+La@TeX{}.}
 
 @vindex tex-default-mode
   @TeX{} mode has four variants: Plain @TeX{} mode, La@TeX{} mode,
-Sli@TeX{} mode, and Doc@TeX{} mode (these distinct major modes differ
-only slightly).  They are designed for editing the four different
-formats.  The command @kbd{M-x tex-mode} looks at the contents of the
-buffer to determine whether the contents appear to be either La@TeX{}
-input, Sli@TeX{}, or Doc@TeX{} input; if so, it selects the
-appropriate mode.  If the file contents do not appear to be La@TeX{},
-Sli@TeX{} or Doc@TeX{}, it selects Plain @TeX{} mode.  If the contents
-are insufficient to determine this, the variable
-@code{tex-default-mode} controls which mode is used.
-
-  When @kbd{M-x tex-mode} does not guess right, you can use the commands
-@kbd{M-x plain-tex-mode}, @kbd{M-x latex-mode}, @kbd{M-x slitex-mode},
-and @kbd{doctex-mode} to select explicitly the particular variants of
-@TeX{} mode.
+Doc@TeX{} mode, and Sli@TeX{} mode.  These distinct major modes differ
+only slightly, and are designed for editing the four different
+formats.  Emacs selects the appropriate mode by looking at the
+contents of the buffer.  (This is done by the @code{tex-mode} command,
+which is normally called automatically when you visit a @TeX{}-like
+file.  @xref{Choosing Modes}.)  If the contents are insufficient to
+determine this, Emacs chooses the mode specified by the variable
+@code{tex-default-mode}; its default value is @code{latex-mode}.  If
+Emacs does not guess right, you can select the correct variant of
+@TeX{} mode using the command @kbd{M-x plain-tex-mode}, @kbd{M-x
+latex-mode}, @kbd{M-x slitex-mode}, or @kbd{doctex-mode}.
+
+  Emacs also provides Bib@TeX{} mode, a major mode for editing
+Bib@TeX{} files.  Bib@TeX{} is a tool for storing and formatting
+bibliographic references, which is commonly used together with
+La@TeX{}.  In addition, the Ref@TeX{} package provides a minor mode
+which can be used in conjunction with La@TeX{} mode to manage
+bibliographic references.  @inforef{Top,, reftex}.
 
 @menu
 * Editing: TeX Editing.   Special commands for editing in TeX mode.
@@ -1414,9 +1401,6 @@ and @kbd{doctex-mode} to select explicitly the particular variants of
 @node TeX Editing
 @subsection @TeX{} Editing Commands
 
-  Here are the special commands provided in @TeX{} mode for editing the
-text of the file.
-
 @table @kbd
 @item "
 Insert, according to context, either @samp{``} or @samp{"} or
@@ -1435,20 +1419,22 @@ Move forward past the next unmatched close brace (@code{up-list}).
 
 @findex tex-insert-quote
 @kindex " @r{(@TeX{} mode)}
-  In @TeX{}, the character @samp{"} is not normally used; we use
-@samp{``} to start a quotation and @samp{''} to end one.  To make
-editing easier under this formatting convention, @TeX{} mode overrides
-the normal meaning of the key @kbd{"} with a command that inserts a pair
-of single-quotes or backquotes (@code{tex-insert-quote}).  To be
-precise, this command inserts @samp{``} after whitespace or an open
-brace, @samp{"} after a backslash, and @samp{''} after any other
-character.
-
-  If you need the character @samp{"} itself in unusual contexts, use
-@kbd{C-q} to insert it.  Also, @kbd{"} with a numeric argument always
-inserts that number of @samp{"} characters.  You can turn off the
-feature of @kbd{"} expansion by eliminating that binding in the local
-map (@pxref{Key Bindings}).
+  In @TeX{}, the character @samp{"} is not normally used; instead,
+quotations begin with @samp{``} and end with @samp{''}.  For
+convenience, @TeX{} mode overrides the normal meaning of the key
+@kbd{"} with a command that inserts a pair of single-quotes or
+backquotes (@code{tex-insert-quote}).  To be precise, it inserts
+@samp{``} after whitespace or an open brace, @samp{"} after a
+backslash, and @samp{''} after any other character.
+
+  As a special exception, if you type @kbd{"} when the text before
+point is either @samp{``} or @samp{''}, Emacs replaces that preceding
+text with a single @samp{"} character.  You can therefore type
+@kbd{""} to insert @samp{"}, should you ever need to do so.  (You can
+also use @kbd{C-q "} to insert this character.)
+
+  To disable the @kbd{"} expansion feature, eliminate that binding in
+the local map (@pxref{Key Bindings}).
 
   In @TeX{} mode, @samp{$} has a special syntax code which attempts to
 understand the way @TeX{} math mode delimiters match.  When you insert a
@@ -1485,15 +1471,15 @@ that buffer to go to a particular mismatch.
   Note that Emacs commands count square brackets and parentheses in
 @TeX{} mode, not just braces.  This is not strictly correct for the
 purpose of checking @TeX{} syntax.  However, parentheses and square
-brackets are likely to be used in text as matching delimiters and it is
-useful for the various motion commands and automatic match display to
-work with them.
+brackets are likely to be used in text as matching delimiters, and it
+is useful for the various motion commands and automatic match display
+to work with them.
 
 @node LaTeX Editing
 @subsection La@TeX{} Editing Commands
 
-  La@TeX{} mode, and its variant, Sli@TeX{} mode, provide a few extra
-features not applicable to plain @TeX{}.
+  La@TeX{} mode (and its obsolete variant, Sli@TeX{} mode) provide a
+few extra features not applicable to plain @TeX{}:
 
 @table @kbd
 @item C-c C-o
@@ -1762,19 +1748,24 @@ required.  This is set up for Czech---customize the group
 Ref@TeX{}.  @inforef{Top,, reftex}.
 
 @node HTML Mode
-@section SGML, XML, and HTML Modes
-
-  The major modes for SGML and HTML include indentation support and
-commands to operate on tags.  This section describes the special
-commands of these modes.  (HTML mode is a slightly customized variant
-of SGML mode.)
+@section SGML and HTML Modes
+@cindex SGML mode
+@cindex HTML mode
+@cindex mode, SGML
+@cindex mode, HTML
+@findex sgml-mode
+@findex html-mode
+
+  The major modes for SGML and HTML provide indentation support and
+commands for operating on tags.  HTML mode is a slightly customized
+variant of SGML mode.
 
 @table @kbd
 @item C-c C-n
 @kindex C-c C-n @r{(SGML mode)}
 @findex sgml-name-char
 Interactively specify a special character and insert the SGML
-@samp{&}-command for that character.
+@samp{&}-command for that character (@code{sgml-name-char}).
 
 @item C-c C-t
 @kindex C-c C-t @r{(SGML mode)}
@@ -1808,7 +1799,7 @@ A numeric argument acts as a repeat count.
 @findex sgml-skip-tag-backward
 Skip backward across a balanced tag group (which extends from an
 opening tag through its corresponding closing tag)
-(@code{sgml-skip-tag-forward}).  A numeric argument acts as a repeat
+(@code{sgml-skip-tag-backward}).  A numeric argument acts as a repeat
 count.
 
 @item C-c C-d
@@ -1850,17 +1841,29 @@ buffer as SGML (@code{sgml-validate}).
 @kindex C-c TAB @r{(SGML mode)}
 @findex sgml-tags-invisible
 Toggle the visibility of existing tags in the buffer.  This can be
-used as a cheap preview.
+used as a cheap preview (@code{sgml-tags-invisible}).
 @end table
 
+@cindex nXML mode
+@cindex mode, nXML
+@findex nxml-mode
+@cindex XML schema
+  The default mode for editing XML documents is called nXML mode
+(@code{xml-mode} or @code{nxml-mode}).  This is a powerful major mode
+that can recognize many existing XML schema and use them to provide
+completion of XML elements via @kbd{C-@key{RET}} or @kbd{M-@key{TAB}},
+as well as ``on-the-fly'' XML validation with error highlighting.  It
+is described in its own manual.  @xref{Top, nXML Mode,,nxml-mode, nXML
+Mode}.
+
 @vindex sgml-xml-mode
-  SGML mode and HTML mode support XML also.  In XML, every opening tag
-must have an explicit closing tag.  When @code{sgml-xml-mode} is
-non-@code{nil}, SGML mode and HTML mode always insert explicit
-closing tags.  When you visit a file, these modes determine from the
-file contents whether it is XML or not, and set @code{sgml-xml-mode}
-accordingly, so that they do the right thing for the file in either
-case.
+  However, you can also use SGML mode to edit XML, since XML is a
+strict subset of SGML.  In XML, every opening tag must have an
+explicit closing tag.  When the variable @code{sgml-xml-mode} is
+non-@code{nil}, the tag insertion commands described above always
+insert explicit closing tags as well.  When you visit a file in SGML
+mode, Emacs determines whether it is XML by examining the file
+contents, and sets @code{sgml-xml-mode} accordingly.
 
 @node Nroff Mode
 @section Nroff Mode