]> code.delx.au - gnu-emacs/blobdiff - doc/emacs/text.texi
Add external socket launching support
[gnu-emacs] / doc / emacs / text.texi
index f10e78e17adf7eb32402faf6f3f38bc4c0ee7de0..41abb42fb5d08490429b1fb9f9e56b6407324298 100644 (file)
@@ -1,6 +1,7 @@
+@c -*- coding: utf-8 -*-
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2012
-@c   Free Software Foundation, Inc.
+@c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2016 Free Software
+@c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Text
 @chapter Commands for Human Languages
@@ -33,7 +34,7 @@ publish them in many formats.
 @cindex mode, XML
 @cindex mode, nXML
 @findex nxml-mode
-  Emacs has other major modes for text which contains ``embedded''
+  Emacs has other major modes for text which contains embedded
 commands, such as @TeX{} and @LaTeX{} (@pxref{TeX Mode}); HTML and
 SGML (@pxref{HTML Mode}); XML
 @ifinfo
@@ -45,9 +46,8 @@ SGML (@pxref{HTML Mode}); XML
 and Groff and Nroff (@pxref{Nroff Mode}).
 
 @cindex ASCII art
-  If you need to edit pictures made out of text characters (commonly
-referred to as ``ASCII art''), use Picture mode, a special major mode
-for editing such pictures.
+  If you need to edit ASCII art pictures made out of text characters,
+use Picture mode, a special major mode for editing such pictures.
 @iftex
 @xref{Picture Mode,,, emacs-xtra, Specialized Emacs Features}.
 @end iftex
@@ -60,7 +60,7 @@ for editing such pictures.
 @cindex templates
 @cindex autotyping
 @cindex automatic typing
-  The ``automatic typing'' features may be useful when writing text.
+  The automatic typing features may be useful when writing text.
 @inforef{Top,The Autotype Manual,autotype}.
 @end ifinfo
 
@@ -69,6 +69,7 @@ for editing such pictures.
 * Sentences::           Moving over and killing sentences.
 * Paragraphs::          Moving over paragraphs.
 * Pages::               Moving over pages.
+* Quotation Marks::     Inserting quotation marks.
 * Filling::             Filling or justifying text.
 * Case::                Changing the case of text.
 * Text Mode::           The major modes for editing text files.
@@ -77,7 +78,7 @@ for editing such pictures.
 * TeX Mode::            Editing TeX and LaTeX files.
 * HTML Mode::           Editing HTML and SGML files.
 * Nroff Mode::          Editing input to the nroff formatter.
-* Enriched Text::       Editing text "enriched" with fonts, colors, etc.
+* Enriched Text::       Editing text enriched with fonts, colors, etc.
 * Text Based Tables::   Commands for editing text-based tables.
 * Two-Column::          Splitting text columns into separate windows.
 @end menu
@@ -116,7 +117,7 @@ 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
-@key{Meta}-based key sequences are analogous to the key sequences
+@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
@@ -330,7 +331,7 @@ in Fundamental mode, @code{paragraph-start} is @w{@code{"\f\\|[
 @cindex formfeed character
   Within some text files, text is divided into @dfn{pages} delimited
 by the @dfn{formfeed character} (@acronym{ASCII} code 12, also denoted
-as @key{control-L}), which is displayed in Emacs as the escape
+as @samp{control-L}), which is displayed in Emacs as the escape
 sequence @samp{^L} (@pxref{Text Display}).  Traditionally, when such
 text files are printed to hardcopy, each formfeed character forces a
 page break.  Most Emacs commands treat it just like any other
@@ -404,6 +405,48 @@ 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 Quotation Marks
+@section Quotation Marks
+@cindex Quotation marks
+@cindex Electric Quote mode
+@cindex mode, Electric Quote
+@cindex curly quotes
+@cindex curved quotes
+@findex electric-quote-mode
+  One common way to quote is the typewriter convention, which quotes
+using straight apostrophes @t{'like this'} or double-quotes @t{"like
+this"}.  Another common way is the curved quote convention, which uses
+left and right single or double quotation marks @t{‘like this’} or
+@t{“like this”}.  In text files, typewriter quotes are simple and
+portable; curved quotes are less ambiguous and typically look nicer.
+
+  Electric Quote mode makes it easier to type curved quotes.  As you
+type characters it optionally converts @t{`} to @t{‘}, @t{'} to @t{’},
+@t{``} to @t{“}, and @t{''} to @t{”}.  These conversions are
+suppressed in buffers whose coding systems cannot represent curved
+quote characters.
+
+@vindex electric-quote-paragraph
+@vindex electric-quote-comment
+@vindex electric-quote-string
+  You can customize the behavior of Electric Quote mode by customizing
+variables that control where it is active.  It is active in text
+paragraphs if @code{electric-quote-paragraph} is non-@code{nil}, in
+programming-language comments if @code{electric-quote-comment} is
+non-@code{nil}, and in programming-language strings if
+@code{electric-quote-string} is non-@code{nil}.  The default is
+@code{nil} for @code{electric-quote-string} and @code{t} for the other
+variables.
+
+  Electric Quote mode is disabled by default.  To toggle it, type
+@kbd{M-x electric-quote-mode}.  To toggle it in a single buffer, use
+@kbd{M-x electric-quote-local-mode}.  To suppress it for a single use,
+type @kbd{C-q `} or @kbd{C-q '} instead of @kbd{`} or @kbd{'}.  To
+insert a curved quote even when Electric Quote is disabled or
+inactive, you can type @kbd{C-x 8 [} for @t{‘}, @kbd{C-x 8 ]} for
+@t{’}, @kbd{C-x 8 @{} for @t{“}, and @kbd{C-x 8 @}} for @t{”}.
+@xref{Inserting Text}.
+
 @node Filling
 @section Filling Text
 @cindex filling text
@@ -562,10 +605,11 @@ customize the abnormal hook variable @code{fill-nobreak-predicate}
 (@pxref{Hooks}).  Each function in this hook is called with no
 arguments, with point positioned where Emacs is considering breaking a
 line.  If a function returns a non-@code{nil} value, Emacs will not
-break the line there.  Two functions you can use are
+break the line there.  Functions you can use there include:
 @code{fill-single-word-nobreak-p} (don't break after the first word of
-a sentence or before the last) and @code{fill-french-nobreak-p} (don't
-break after @samp{(} or before @samp{)}, @samp{:} or @samp{?}).
+a sentence or before the last); @code{fill-single-char-nobreak-p}
+(don't break after a one-letter word); and @code{fill-french-nobreak-p}
+(don't break after @samp{(} or before @samp{)}, @samp{:} or @samp{?}).
 
 @node Fill Prefix
 @subsection The Fill Prefix
@@ -639,7 +683,7 @@ delimiter on each line.
 prefix for each paragraph automatically.  This command divides the
 region into paragraphs, treating every change in the amount of
 indentation as the start of a new paragraph, and fills each of these
-paragraphs.  Thus, all the lines in one ``paragraph'' have the same
+paragraphs.  Thus, all the lines in one paragraph have the same
 amount of indentation.  That indentation serves as the fill prefix for
 that paragraph.
 
@@ -818,10 +862,10 @@ indenting the current line.  @xref{Indentation}, for details.
 
   Text mode turns off the features concerned with comments except when
 you explicitly invoke them.  It changes the syntax table so that
-single-quotes are considered part of words (e.g.@: @samp{don't} is
+single-quotes are considered part of words (e.g., @samp{don't} is
 considered one word).  However, if a word starts with a single-quote,
 it is treated as a prefix for the purposes of capitalization
-(e.g.@: @kbd{M-c} converts @samp{'hello'} into @samp{'Hello'}, as
+(e.g., @kbd{M-c} converts @samp{'hello'} into @samp{'Hello'}, as
 expected).
 
 @cindex Paragraph-Indent Text mode
@@ -1029,7 +1073,7 @@ revealing parts of the buffer, based on the outline structure.  These
 commands are not undoable; their effects are simply not recorded by
 the undo mechanism, so you can undo right past them (@pxref{Undo}).
 
-  Many of these commands act on the ``current'' heading line.  If
+  Many of these commands act on the current heading line.  If
 point is on a heading line, that is the current heading line; if point
 is on a body line, the current heading line is the nearest preceding
 header line.
@@ -1096,9 +1140,9 @@ direct and indirect, and all of their bodies.
 current heading line as well as all the bodies in its subtree; the
 subheadings themselves are left visible.  The command @kbd{C-c C-k}
 (@code{show-branches}) reveals the subheadings, if they had previously
-been hidden (e.g.@: by @kbd{C-c C-d}).  The command @kbd{C-c C-i}
+been hidden (e.g., by @kbd{C-c C-d}).  The command @kbd{C-c C-i}
 (@code{show-children}) is a weaker version of this; it reveals just
-the direct subheadings, i.e.@: those one level down.
+the direct subheadings, i.e., those one level down.
 
 @findex hide-other
 @kindex C-c C-o @r{(Outline mode)}
@@ -1123,12 +1167,18 @@ though these are technically body lines).  @kbd{C-c C-a}
 numeric argument @var{n}, it hides everything except the top @var{n}
 levels of heading lines.
 
+@anchor{Outline Search}
 @findex reveal-mode
+@vindex search-invisible
   When incremental search finds text that is hidden by Outline mode,
 it makes that part of the buffer visible.  If you exit the search at
-that position, the text remains visible.  You can also automatically
-make text visible as you navigate in it by using Reveal mode (@kbd{M-x
-reveal-mode}), a buffer-local minor mode.
+that position, the text remains visible.  To toggle whether or not
+an active incremental search can match hidden text, type @kbd{M-s i}.
+To change the default for future searches, customize the option
+@code{search-invisible}.  (This option also affects how @code{query-replace}
+and related functions treat hidden text, @pxref{Query Replace}.)
+You can also automatically make text visible as you navigate in it by
+using Reveal mode (@kbd{M-x reveal-mode}), a buffer-local minor mode.
 
 @node Outline Views
 @subsection Viewing One Outline in Multiple Views
@@ -1155,7 +1205,7 @@ buffers.
 
 @cindex folding editing
   The Foldout package extends Outline mode and Outline minor mode with
-``folding'' commands.  The idea of folding is that you zoom in on a
+folding commands.  The idea of folding is that you zoom in on a
 nested portion of the outline, while hiding its relatives at higher
 levels.
 
@@ -1177,7 +1227,7 @@ in the mode line shows how deep you've gone.
 
   When zooming in on a heading, to see only the child subheadings specify
 a numeric argument: @kbd{C-u C-c C-z}.  The number of levels of children
-can be specified too (compare @kbd{M-x show-children}), e.g.@: @kbd{M-2
+can be specified too (compare @kbd{M-x show-children}), e.g., @kbd{M-2
 C-c C-z} exposes two levels of child subheadings.  Alternatively, the
 body can be specified with a negative argument: @kbd{M-- C-c C-z}.  The
 whole subtree can be expanded, similarly to @kbd{C-c C-s} (@kbd{M-x
@@ -1185,7 +1235,7 @@ show-subtree}), by specifying a zero argument: @kbd{M-0 C-c C-z}.
 
   While you're zoomed in, you can still use Outline mode's exposure and
 hiding functions without disturbing Foldout.  Also, since the buffer is
-narrowed, ``global'' editing actions will only affect text under the
+narrowed, global editing actions will only affect text under the
 zoomed-in heading.  This is useful for restricting changes to a
 particular chapter or section of your document.
 
@@ -1243,7 +1293,7 @@ quad click: exit all folds and hide text.
 @c FIXME not marked as a user variable
 @vindex foldout-mouse-modifiers
   You can specify different modifier keys (instead of
-@kbd{Control-Meta-}) by setting @code{foldout-mouse-modifiers}; but if
+@kbd{@key{Ctrl}-@key{META}-}) by setting @code{foldout-mouse-modifiers}; but if
 you have already loaded the @file{foldout.el} library, you must reload
 it in order for this to take effect.
 
@@ -1286,7 +1336,7 @@ executed.
 
 @kindex S-TAB @r{(Org Mode)}
 @findex org-shifttab
-  Typing @key{S-TAB} (@code{org-shifttab}) anywhere in an Org mode
+  Typing @kbd{S-@key{TAB}} (@code{org-shifttab}) anywhere in an Org mode
 buffer cycles the visibility of the entire outline structure, between
 (i) showing only top-level heading lines, (ii) showing all heading
 lines but no body lines, and (iii) showing everything.
@@ -1349,7 +1399,7 @@ date, beneath the heading line.  The command @kbd{C-c C-d}
   Once you have some TODO items planned in an Org file, you can add
 that file to the list of @dfn{agenda files} by typing @kbd{C-c [}
 (@code{org-agenda-file-to-front}).  Org mode is designed to let you
-easily maintain multiple agenda files, e.g.@: for organizing different
+easily maintain multiple agenda files, e.g., for organizing different
 aspects of your life.  The list of agenda files is stored in the
 variable @code{org-agenda-files}.
 
@@ -1372,7 +1422,7 @@ etc.
 export and publication.  To export the current buffer, type @kbd{C-c
 C-e} (@code{org-export}) anywhere in an Org buffer.  This command
 prompts for an export format; currently supported formats include
-HTML, @LaTeX{}, OpenDocument (@file{.odt}), and PDF.  Some formats,
+HTML, @LaTeX{}, OpenDocument (@file{.odt}), and PDF@.  Some formats,
 such as PDF, require certain system tools to be installed.
 
 @vindex org-publish-project-alist
@@ -1399,7 +1449,7 @@ This is an example.
 #+end_example
 @end example
 
-  For further details, see @ref{Exporting,,,org, The Org Manual} and
+  For further details, @ref{Exporting,,,org, The Org Manual}, and
 @ref{Publishing,,,org, The Org Manual}.
 
 @node TeX Mode
@@ -1606,7 +1656,7 @@ when you type the corresponding one.
 @subsection @TeX{} Printing Commands
 
   You can invoke @TeX{} as an subprocess of Emacs, supplying either
-the entire contents of the buffer or just part of it (e.g.@: one
+the entire contents of the buffer or just part of it (e.g., one
 chapter of a larger document).
 
 @table @kbd
@@ -1667,6 +1717,7 @@ such as @code{"/tmp"}.
 @vindex latex-run-command
 @vindex tex-dvi-view-command
 @vindex tex-dvi-print-command
+@vindex tex-print-file-extension
   The buffer's @TeX{} variant determines what shell command @kbd{C-c
 C-b} actually runs.  In Plain @TeX{} mode, it is specified by the
 variable @code{tex-run-command}, which defaults to @code{"tex"}.  In
@@ -1675,13 +1726,18 @@ defaults to @code{"latex"}.  The shell command that @kbd{C-c C-v} runs
 to view the @file{.dvi} output is determined by the variable
 @code{tex-dvi-view-command}, regardless of the @TeX{} variant.  The
 shell command that @kbd{C-c C-p} runs to print the output is
-determined by the variable @code{tex-dvi-print-command}.
+determined by the variable @code{tex-dvi-print-command}.  The variable
+@code{tex-print-file-extension} can be set to the required file
+extension for viewing and printing @TeX{}-compiled files.  For
+example, you can set it to @file{.pdf}, and update
+@code{tex-dvi-view-command} and @code{tex-dvi-print-command}
+accordingly.
 
   Normally, Emacs automatically appends the output file name to the
 shell command strings described in the preceding paragraph.  For
 example, if @code{tex-dvi-view-command} is @code{"xdvi"}, @kbd{C-c
 C-v} runs @command{xdvi @var{output-file-name}}.  In some cases,
-however, the file name needs to be embedded in the command, e.g.@: if
+however, the file name needs to be embedded in the command, e.g., if
 you need to provide the file name as an argument to one command whose
 output is piped to another.  You can specify where to put the file
 name with @samp{*} in the command string.  For example,
@@ -1903,7 +1959,7 @@ characters themselves (@code{sgml-name-8bit-mode}).
 Run a shell command (which you must specify) to validate the current
 buffer as SGML (@code{sgml-validate}).
 
-@item C-c TAB
+@item C-c @key{TAB}
 @kindex C-c TAB @r{(SGML mode)}
 @findex sgml-tags-invisible
 Toggle the visibility of existing tags in the buffer.  This can be
@@ -1917,7 +1973,7 @@ used as a cheap preview (@code{sgml-tags-invisible}).
   The major mode for editing XML documents is called 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
+@kbd{M-@key{TAB}}, as well as on-the-fly XML
 validation with error highlighting.  To enable nXML mode in an
 existing buffer, type @kbd{M-x nxml-mode}, or, equivalently, @kbd{M-x
 xml-mode}.  Emacs uses nXML mode for files which have the extension
@@ -1936,7 +1992,7 @@ Emacs.
 
 @vindex sgml-xml-mode
   You may choose to use the less powerful SGML mode for editing XML,
-since XML is a strict subset of SGML.  To enable SGML mode in an
+since XML is a strict subset of SGML@.  To enable SGML mode in an
 existing buffer, type @kbd{M-x sgml-mode}.  On enabling SGML mode,
 Emacs examines the buffer to determine whether it is XML; if so, it
 sets the variable @code{sgml-xml-mode} to a non-@code{nil} value.
@@ -1950,7 +2006,7 @@ always insert explicit closing tags as well.
 @findex nroff-mode
 @vindex nroff-mode-hook
   Nroff mode, a major mode derived from Text mode, is
-specialized for editing nroff files (e.g.@: Unix man pages).  Type
+specialized for editing nroff files (e.g., Unix man pages).  Type
 @kbd{M-x nroff-mode} to enter this mode.  Entering Nroff mode runs the
 hook @code{text-mode-hook}, then @code{nroff-mode-hook}
 (@pxref{Hooks}).
@@ -1998,7 +2054,7 @@ number (the header level).
 @cindex text/enriched MIME format
 
   Enriched mode is a minor mode for editing formatted text files in a
-WYSIWYG (``what you see is what you get'') fashion.  When Enriched
+WYSIWYG (What You See Is What You Get) fashion.  When Enriched
 mode is enabled, you can apply various formatting properties to the
 text in the buffer, such as fonts and colors; upon saving the buffer,
 those properties are saved together with the text, using the MIME
@@ -2011,8 +2067,8 @@ highlighting (@pxref{Font Lock}).  Unlike Enriched mode, Font Lock
 mode assigns text properties automatically, based on the current
 buffer contents; those properties are not saved to disk.
 
-  The file @file{etc/enriched.doc} in the Emacs distribution serves as
-an example of the features of Enriched mode.
+  The file @file{enriched.txt} in Emacs's @code{data-directory}
+serves as an example of the features of Enriched mode.
 
 @menu
 * Enriched Mode::           Entering and exiting Enriched mode.
@@ -2022,7 +2078,7 @@ an example of the features of Enriched mode.
 * Enriched Indentation::    Changing the left and right margins.
 * Enriched Justification::  Centering, setting text flush with the
                               left or right margin, etc.
-* Enriched Properties::     The "special" text properties submenu.
+* Enriched Properties::     The ``special text properties'' submenu.
 @end menu
 
 @node Enriched Mode
@@ -2086,6 +2142,7 @@ newlines are used for filling.  The @key{RET} (@code{newline}) and
 commands, including Auto Fill (@pxref{Auto Fill}), insert only soft
 newlines and delete only soft newlines, leaving hard newlines alone.
 
+@c FIXME: I don't see 'unfilled' in that node.  --xfq
   Thus, when editing with Enriched mode, you should not use @key{RET}
 or @kbd{C-o} to break lines in the middle of filled paragraphs.  Use
 Auto Fill mode or explicit fill commands (@pxref{Fill Commands})
@@ -2097,11 +2154,12 @@ want to set the justification style to @code{unfilled}
 @node Editing Format Info
 @subsection Editing Format Information
 
-  The easiest way to alter properties is with the Text Properties
-menu.  You can get to this menu from the Edit menu in the menu bar
-(@pxref{Menu Bar}), or with @kbd{C-Mouse-2} (@pxref{Menu Mouse
-Clicks}).  Some of the commands in the Text Properties menu are listed
-below (you can also invoke them with @kbd{M-x}):
+  The easiest way to alter properties is with the @samp{Text
+Properties} menu.  You can get to this menu from the @samp{Edit} menu
+in the menu bar (@pxref{Menu Bar}), or with @kbd{C-Mouse-2}
+(@pxref{Menu Mouse Clicks}).  Some of the commands in the @samp{Text
+Properties} menu are listed below (you can also invoke them with
+@kbd{M-x}):
 
 @table @code
 @findex facemenu-remove-face-props
@@ -2255,6 +2313,7 @@ Prefix}.
 
 @node Enriched Justification
 @subsection Justification in Enriched Text
+@cindex justification style
 
   In Enriched mode, you can use the following commands to specify
 various @dfn{justification styles} for filling.  These commands apply
@@ -2295,11 +2354,11 @@ still indent the left margin.
 
 @vindex default-justification
   You can also specify justification styles using the Justification
-submenu in the Text Properties menu.
-  The default justification style is specified by the per-buffer
-variable @code{default-justification}.  Its value should be one of the
-symbols @code{left}, @code{right}, @code{full}, @code{center}, or
-@code{none}.
+submenu in the Text Properties menu.  The default justification style
+is specified by the per-buffer variable @code{default-justification}.
+Its value should be one of the symbols @code{left}, @code{right},
+@code{full}, @code{center}, or @code{none}; their meanings correspond
+to the commands above.
 
 @node Enriched Properties
 @subsection Setting Other Text Properties
@@ -2706,7 +2765,7 @@ and 3 rows, and a total of 5 cells.
 
 @findex table-insert-sequence
   @kbd{M-x table-insert-sequence} inserts a string into each cell.
-Each string is a part of a sequence i.e.@: a series of increasing
+Each string is a part of a sequence i.e., a series of increasing
 integer numbers.
 
 @cindex table for HTML and LaTeX
@@ -2779,8 +2838,8 @@ puts the text after the separator into the right-hand buffer, and
 deletes the separator.  Lines that don't have the column separator at
 the proper place remain unsplit; they stay in the left-hand buffer, and
 the right-hand buffer gets an empty line to correspond.  (This is the
-way to write a line that ``spans both columns while in two-column
-mode'': write it in the left-hand buffer, and put an empty line in the
+way to write a line that spans both columns while in two-column
+mode: write it in the left-hand buffer, and put an empty line in the
 right-hand buffer.)
 
 @kindex F2 RET