]> code.delx.au - gnu-emacs/blobdiff - man/misc.texi
Many cleanups.
[gnu-emacs] / man / misc.texi
index 7e02d1121951722ab7533ed7ca6d2c9b067eff5a..d5b69eebf26ed7568b5508c647bf61a41e72de14 100644 (file)
@@ -1,6 +1,6 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985, 86, 87, 93, 94, 95, 97, 2000, 2001
-@c   Free Software Foundation, Inc.
+@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001,
+@c   2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @iftex
 @chapter Miscellaneous Commands
@@ -14,6 +14,11 @@ an Emacs session for later resumption, emulating other editors, and
 various diversions and amusements.
 
 @end iftex
+
+@ifnottex
+@raisesections
+@end ifnottex
+
 @node Gnus, Shell, Calendar/Diary, Top
 @section Gnus
 @cindex Gnus
@@ -47,7 +52,7 @@ To start Gnus, type @kbd{M-x gnus @key{RET}}.
 As opposed to most normal Emacs packages, Gnus uses a number of
 different buffers to display information and to receive commands.  The
 three buffers users spend most of their time in are the @dfn{group
-buffer}, the @dfn{summary buffer} and the @dfn{article buffer}.  
+buffer}, the @dfn{summary buffer} and the @dfn{article buffer}.
 
 The @dfn{group buffer} contains a list of groups.  This is the first
 buffer Gnus displays when it starts up.  It normally displays only the
@@ -161,7 +166,7 @@ In the group buffer, select the group on the line under the cursor
 and display the first unread article in that group.
 
 @need 1000
-In the summary buffer, 
+In the summary buffer,
 
 @itemize @bullet
 @item
@@ -291,7 +296,7 @@ Save articles. @xref{Saving Articles, , , gnus, The Gnus Manual}.
 @item
 Have Gnus score articles according to various criteria, like author
 name, subject, or string in the body of the articles.@*
-@xref{Scoring, , , gnus, The Gnus Manual}. 
+@xref{Scoring, , , gnus, The Gnus Manual}.
 
 @item
 Send an article to a newsgroup.@*
@@ -337,6 +342,7 @@ Start the Emacs shell.
 * Single Shell::           How to run one shell command and return.
 * Interactive Shell::      Permanent shell taking input via Emacs.
 * Shell Mode::             Special Emacs commands used with permanent shell.
+* Shell Prompts::          Two ways to recognize shell prompts.
 * History: Shell History.  Repeating previous commands in a shell buffer.
 * Directory Tracking::     Keeping track when the subshell changes directory.
 * Options: Shell Options.  Options for customizing Shell mode.
@@ -384,12 +390,11 @@ insert the output in the current buffer, then the old region is deleted
 first and the output replaces it as the contents of the region.  It
 returns the command's exit status when it is called from a Lisp program.
 
-  One use for @kbd{M-|} is to run @code{uudecode}.  For instance, if
-the buffer contains uuencoded text, type @kbd{C-x h M-| uudecode
-@key{RET}} to feed the entire buffer contents to the @code{uudecode}
-program.  That program will ignore everything except the encoded text,
-and will store the decoded output into the file whose name is
-specified in the encoded text.
+  One use for @kbd{M-|} is to run @code{gpg} to see what keys are in
+the buffer.  For instance, if the buffer contains a GPG key, type
+@kbd{C-x h M-| gpg @key{RET}} to feed the entire buffer contents
+to the @code{gpg} program.  That program will ignore everything except
+the encoded keys, and will output a list of the keys it contains.
 
 @vindex shell-file-name
   Both @kbd{M-!} and @kbd{M-|} use @code{shell-file-name} to specify the
@@ -400,16 +405,21 @@ searched; this list is initialized based on the environment variable
 @env{PATH} when Emacs is started.  Your @file{.emacs} file can override
 either or both of these default initializations.@refill
 
-  Both @kbd{M-!} and @kbd{M-|} wait for the shell command to complete.
-To stop waiting, type @kbd{C-g} to quit; that terminates the shell
+  Both @kbd{M-!} and @kbd{M-|} wait for the shell command to complete,
+unless you end the command with @samp{&} to make it asynchronous.  To
+stop waiting, type @kbd{C-g} to quit; that terminates the shell
 command with the signal @code{SIGINT}---the same signal that @kbd{C-c}
-normally generates in the shell.  Emacs waits until the command actually
-terminates.  If the shell command doesn't stop (because it ignores the
-@code{SIGINT} signal), type @kbd{C-g} again; this sends the command a
-@code{SIGKILL} signal which is impossible to ignore.
+normally generates in the shell.  Emacs waits until the command
+actually terminates.  If the shell command doesn't stop (because it
+ignores the @code{SIGINT} signal), type @kbd{C-g} again; this sends
+the command a @code{SIGKILL} signal which is impossible to ignore.
+
+  Asynchronous commands ending in @samp{&} feed their output into
+the buffer @samp{*Async Shell Command*}.  Output arrives in that
+buffer regardless of whether it is visible in a window.
 
   To specify a coding system for @kbd{M-!} or @kbd{M-|}, use the command
-@kbd{C-x @key{RET} c} immediately beforehand.  @xref{Specify Coding}.
+@kbd{C-x @key{RET} c} immediately beforehand.  @xref{Communication Coding}.
 
 @vindex shell-command-default-error-buffer
   Error output from the command is normally intermixed with the regular
@@ -471,7 +481,7 @@ from.  For example, if you use bash, the file sent to it is
   To specify a coding system for the shell, you can use the command
 @kbd{C-x @key{RET} c} immediately before @kbd{M-x shell}.  You can also
 specify a coding system after starting the shell by using @kbd{C-x
-@key{RET} p} in the shell buffer.  @xref{Specify Coding}.
+@key{RET} p} in the shell buffer.  @xref{Communication Coding}.
 
 @cindex @env{EMACS} environment variable
   Unless the environment variable @env{EMACS} is already defined,
@@ -497,8 +507,8 @@ of the special key bindings of Shell mode:
 At end of buffer send line as input; otherwise, copy current line to
 end of buffer and send it (@code{comint-send-input}).  When a line is
 copied, any prompt at the beginning of the line (text output by
-programs preceding your input) is omitted.  (See also the variable
-@code{comint-use-prompt-regexp-instead-of-fields}.)
+programs preceding your input) is omitted.  @xref{Shell Prompts}, for
+how Shell mode recognizes prompts.
 
 @item @key{TAB}
 @kindex TAB @r{(Shell mode)}
@@ -526,9 +536,9 @@ before point in the shell buffer
 @item C-d
 @kindex C-d @r{(Shell mode)}
 @findex comint-delchar-or-maybe-eof
-Either delete a character or send @sc{eof}
+Either delete a character or send @acronym{EOF}
 (@code{comint-delchar-or-maybe-eof}).  Typed at the end of the shell
-buffer, @kbd{C-d} sends @sc{eof} to the subshell.  Typed at any other
+buffer, @kbd{C-d} sends @acronym{EOF} to the subshell.  Typed at any other
 position in the buffer, @kbd{C-d} deletes a character as usual.
 
 @item C-c C-a
@@ -553,7 +563,8 @@ the newline that separates them), when you type @key{RET}.
 @kindex C-c C-u @r{(Shell mode)}
 @findex comint-kill-input
 Kill all text pending at end of buffer to be sent as input
-(@code{comint-kill-input}).
+(@code{comint-kill-input}).  If point is not at end of buffer,
+this only kills the part of this text that precedes point.
 
 @item C-c C-w
 @kindex C-c C-w @r{(Shell mode)}
@@ -624,12 +635,6 @@ specifies how to recognize the end of a command.
 Move backward across one shell command, but not beyond the current line
 (@code{shell-backward-command}).
 
-@item C-c C-l
-@kindex C-c C-l @r{(Shell mode)}
-@findex comint-dynamic-list-input-ring
-Display the buffer's history of shell commands in another window
-(@code{comint-dynamic-list-input-ring}).
-
 @item M-x dirs
 Ask the shell what its current directory is, so that Emacs can agree
 with the shell.
@@ -640,12 +645,13 @@ Send @var{text} as input to the shell, after reading it without
 echoing.  This is useful when a shell command runs a program that asks
 for a password.
 
-Alternatively, you can arrange for Emacs to notice password prompts
-and turn off echoing for them, as follows:
+Please note that Emacs will not echo passwords by default.  If you
+really want them to be echoed, evaluate the following Lisp
+expression:
 
 @example
-(add-hook 'comint-output-filter-functions
-          'comint-watch-for-password-prompt)
+(remove-hook 'comint-output-filter-functions
+             'comint-watch-for-password-prompt)
 @end example
 
 @item M-x comint-continue-subjob
@@ -681,10 +687,6 @@ subshell:
 @end example
 @end table
 
-  Shell mode also customizes the paragraph commands so that only shell
-prompts start new paragraphs.  Thus, a paragraph consists of an input
-command plus the output that follows it in the buffer.
-
 @cindex Comint mode
 @cindex mode, Comint
   Shell mode is a derivative of Comint mode, a general-purpose mode for
@@ -701,16 +703,55 @@ the directory tracking feature, and a few user commands.
 in a subprocess using unmodified Comint mode---without the
 specializations of Shell mode.
 
+@node Shell Prompts
+@subsection Shell Prompts
+
+@vindex shell-prompt-pattern
+@vindex comint-prompt-regexp
+@vindex comint-use-prompt-regexp
+@cindex prompt, shell
+  A prompt is text output by a program to show that it is ready to
+accept new user input.  Normally, Comint mode (and thus Shell mode)
+considers the prompt to be any text output by a program at the
+beginning of an input line.  However, if the variable
+@code{comint-use-prompt-regexp} is non-@code{nil}, then Comint mode
+uses a regular expression to recognize prompts.  In Shell mode,
+@code{shell-prompt-pattern} specifies the regular expression.
+
+  The value of @code{comint-use-prompt-regexp} also affects many
+motion and paragraph commands.  If the value is non-@code{nil}, the
+general Emacs motion commands behave as they normally do in buffers
+without special text properties.  However, if the value is @code{nil},
+the default, then Comint mode divides the buffer into two types of
+``fields'' (ranges of consecutive characters having the same
+@code{field} text property): input and output.  Prompts are part of
+the output.  Most Emacs motion commands do not cross field boundaries,
+unless they move over multiple lines.  For instance, when point is in
+input on the same line as a prompt, @kbd{C-a} puts point at the
+beginning of the input if @code{comint-use-prompt-regexp} is
+@code{nil} and at the beginning of the line otherwise.
+
+  In Shell mode, only shell prompts start new paragraphs.  Thus, a
+paragraph consists of a prompt and the input and output that follow
+it.  However, if @code{comint-use-prompt-regexp} is @code{nil}, the
+default, most paragraph commands do not cross field boundaries.  This
+means that prompts, ranges of input, and ranges of non-prompt output
+behave mostly like separate paragraphs; with this setting, numeric
+arguments to most paragraph commands yield essentially undefined
+behavior.  For the purpose of finding paragraph boundaries, Shell mode
+uses @code{shell-prompt-pattern}, regardless of
+@code{comint-use-prompt-regexp}.
+
 @node Shell History
 @subsection Shell Command History
 
   Shell buffers support three ways of repeating earlier commands.  You
-can use the same keys used in the minibuffer; these work much as they do
-in the minibuffer, inserting text from prior commands while point
-remains always at the end of the buffer.  You can move through the
-buffer to previous inputs in their original place, then resubmit them or
-copy them to the end.  Or you can use a @samp{!}-style history
-reference.
+can use keys like those used for the minibuffer history; these work
+much as they do in the minibuffer, inserting text from prior commands
+while point remains always at the end of the buffer.  You can move
+through the buffer to previous inputs in their original place, then
+resubmit them or copy them to the end.  Or you can use a
+@samp{!}-style history reference.
 
 @menu
 * Ring: Shell Ring.             Fetching commands from the history list.
@@ -725,11 +766,13 @@ reference.
 @findex comint-previous-input
 @kindex M-p @r{(Shell mode)}
 @item M-p
+@itemx C-@key{UP}
 Fetch the next earlier old shell command.
 
 @kindex M-n @r{(Shell mode)}
 @findex comint-next-input
 @item M-n
+@itemx C-@key{DOWN}
 Fetch the next later old shell command.
 
 @kindex M-r @r{(Shell mode)}
@@ -740,9 +783,21 @@ Fetch the next later old shell command.
 @itemx M-s @var{regexp} @key{RET}
 Search backwards or forwards for old shell commands that match @var{regexp}.
 
-@item C-c C-x @r{(Shell mode)}
+@item C-c C-x
+@kindex C-c C-x @r{(Shell mode)}
 @findex comint-get-next-from-history
 Fetch the next subsequent command from the history.
+
+@item C-c .
+@kindex C-c . @r{(Shell mode)}
+@findex comint-input-previous-argument
+Fetch one argument from an old shell command.
+
+@item C-c C-l
+@kindex C-c C-l @r{(Shell mode)}
+@findex comint-dynamic-list-input-ring
+Display the buffer's history of shell commands in another window
+(@code{comint-dynamic-list-input-ring}).
 @end table
 
   Shell buffers provide a history of previously entered shell commands.  To
@@ -751,11 +806,13 @@ reuse shell commands from the history, use the editing commands @kbd{M-p},
 history commands except that they operate on the text at the end of the
 shell buffer, where you would normally insert text to send to the shell.
 
-  @kbd{M-p} fetches an earlier shell command to the end of the shell buffer.
-Successive use of @kbd{M-p} fetches successively earlier shell commands,
-each replacing any text that was already present as potential shell input.
-@kbd{M-n} does likewise except that it finds successively more recent shell
-commands from the buffer.
+  @kbd{M-p} fetches an earlier shell command to the end of the shell
+buffer.  Successive use of @kbd{M-p} fetches successively earlier
+shell commands, each replacing any text that was already present as
+potential shell input.  @kbd{M-n} does likewise except that it finds
+successively more recent shell commands from the buffer.
+@kbd{C-@key{UP}} works like @kbd{M-p}, and @kbd{C-@key{DOWN}} like
+@kbd{M-n}.
 
   The history search commands @kbd{M-r} and @kbd{M-s} read a regular
 expression and search through the history for a matching command.  Aside
@@ -775,6 +832,15 @@ you just repeated.  Then type @key{RET} to reexecute this command.  You
 can reexecute several successive commands by typing @kbd{C-c C-x
 @key{RET}} over and over.
 
+  The command @kbd{C-c .}@: (@code{comint-input-previous-argument})
+copies an individual argument from a previous command, like @kbd{ESC
+.} in Bash.  The simplest use copies the last argument from the
+previous shell command.  With a prefix argument @var{n}, it copies the
+@var{n}th argument instead.  Repeating @kbd{C-c .} copies from an
+earlier shell command instead, always using the same value of @var{n}
+(don't give a prefix argument when you repeat the @kbd{C-c .}
+command).
+
   These commands get the text of previous shell commands from a special
 history list, not from the shell buffer itself.  Thus, editing the shell
 buffer, or even killing large parts of it, does not affect the history
@@ -782,7 +848,7 @@ that these commands access.
 
 @vindex shell-input-ring-file-name
   Some shells store their command histories in files so that you can
-refer to previous commands from previous shell sessions.  Emacs reads
+refer to commands from previous shell sessions.  Emacs reads
 the command history file for your chosen shell, to initialize its own
 command history.  The file name is @file{~/.bash_history} for bash,
 @file{~/.sh_history} for ksh, and @file{~/.history} for other shells.
@@ -802,21 +868,26 @@ Move point to the previous prompt (@code{comint-previous-prompt}).
 Move point to the following prompt (@code{comint-next-prompt}).
 
 @kindex C-c RET @r{(Shell mode)}
-@findex comint-copy-old-input
+@findex comint-insert-input
 @item C-c @key{RET}
 Copy the input command which point is in, inserting the copy at the end
-of the buffer (@code{comint-copy-old-input}).  This is useful if you
+of the buffer (@code{comint-insert-input}).  This is useful if you
 move point back to a previous command.  After you copy the command, you
 can submit the copy as input with @key{RET}.  If you wish, you can
 edit the copy before resubmitting it.
+
+@item Mouse-2
+Copy the input command that you click on, inserting the copy at the end
+of the buffer.
 @end table
 
   Moving to a previous input and then copying it with @kbd{C-c
-@key{RET}} produces the same results---the same buffer contents---that
-you would get by using @kbd{M-p} enough times to fetch that previous
-input from the history list.  However, @kbd{C-c @key{RET}} copies the
-text from the buffer, which can be different from what is in the history
-list if you edit the input text in the buffer after it has been sent.
+@key{RET}} or @kbd{Mouse-2} produces the same results---the same
+buffer contents---that you would get by using @kbd{M-p} enough times
+to fetch that previous input from the history list.  However, @kbd{C-c
+@key{RET}} copies the text from the buffer, which can be different
+from what is in the history list if you edit the input text in the
+buffer after it has been sent.
 
 @node History References
 @subsubsection Shell History References
@@ -843,19 +914,8 @@ when you send them to the shell.  To request this, set the variable
 @key{SPC} perform history expansion by binding @key{SPC} to the
 command @code{comint-magic-space}.
 
-@vindex shell-prompt-pattern
-@vindex comint-prompt-regexp
-@vindex comint-use-prompt-regexp-instead-of-fields
-@cindex prompt, shell
   Shell mode recognizes history references when they follow a prompt.
-Normally, any text output by a program at the beginning of an input
-line is considered a prompt.  However, if the variable
-@code{comint-use-prompt-regexp-instead-of-fields} is non-@code{nil},
-then Comint mode uses a regular expression to recognize prompts.  In
-general, the variable @code{comint-prompt-regexp} specifies the
-regular expression; Shell mode uses the variable
-@code{shell-prompt-pattern} to set up @code{comint-prompt-regexp} in
-the shell buffer.
+@xref{Shell Prompts}, for how Shell mode recognizes prompts.
 
 @node Directory Tracking
 @subsection Directory Tracking
@@ -908,13 +968,13 @@ to the bottom before inserting.
 
 @vindex comint-scroll-show-maximum-output
   If @code{comint-scroll-show-maximum-output} is non-@code{nil}, then
-scrolling due to the arrival of output tries to place the last line of
+arrival of output when point is at the end tries to place the last line of
 text at the bottom line of the window, so as to show as much useful
 text as possible.  (This mimics the scrolling behavior of many
 terminals.)  The default is @code{nil}.
 
-@vindex comint-scroll-to-bottom-on-output
-  By setting @code{comint-scroll-to-bottom-on-output}, you can opt for
+@vindex comint-move-point-for-output
+  By setting @code{comint-move-point-for-output}, you can opt for
 having point jump to the end of the buffer whenever output arrives---no
 matter where in the buffer point was before.  If the value is
 @code{this}, point jumps in the selected window.  If the value is
@@ -923,6 +983,10 @@ the value is @code{other}, point jumps in all nonselected windows that
 show the current buffer.  The default value is @code{nil}, which means
 point does not jump to the end.
 
+@vindex comint-prompt-read-only
+  If you set @code{comint-prompt-read-only}, the prompts in the Comint
+buffer are read-only.
+
 @vindex comint-input-ignoredups
   The variable @code{comint-input-ignoredups} controls whether successive
 identical inputs are stored in the input history.  A non-@code{nil}
@@ -1018,14 +1082,14 @@ subshell, except for the Term escape character, normally @kbd{C-c}.
   To switch between line and char mode, use these commands:
 
 @table @kbd
-@kindex C-c C-k @r{(Term mode)}
+@kindex C-c C-j @r{(Term mode)}
 @findex term-char-mode
-@item C-c C-k
+@item C-c C-j
 Switch to line mode.  Do nothing if already in line mode.
 
-@kindex C-c C-j @r{(Term mode)}
+@kindex C-c C-k @r{(Term mode)}
 @findex term-line-mode
-@item C-c C-j
+@item C-c C-k
 Switch to char mode.  Do nothing if already in char mode.
 @end table
 
@@ -1035,10 +1099,10 @@ Switch to char mode.  Do nothing if already in char mode.
 @item C-c C-c
 Send a literal @key{C-c} to the sub-shell.
 
-@item C-c C-x
-A prefix command to access the global @key{C-x} commands conveniently.
-For example, @kbd{C-c C-x o} invokes the global binding of
-@kbd{C-x o}, which is normally @samp{other-window}.
+@item C-c @var{char}
+This is equivalent to @kbd{C-x @var{char}} in normal Emacs.  For
+example, @kbd{C-c o} invokes the global binding of @kbd{C-x o}, which
+is normally @samp{other-window}.
 @end table
 
 @node Paging in Term
@@ -1082,8 +1146,11 @@ temporarily visible, but will be erased when you hit return.  (This
 happens automatically; there is no special password processing.)
 
   When you log in to a different machine, you need to specify the type
-of terminal you're using.  Terminal types @samp{ansi} or @samp{vt100}
-will work on most systems.
+of terminal you're using, by setting the @env{TERM} environment
+variable in the environment for the remote login command.  (If you use
+bash, you do that by writing the variable assignment before the remote
+login command, without separating comma.)  Terminal types @samp{ansi}
+or @samp{vt100} will work on most systems.
 
 @c   If you are talking to a Bourne-compatible
 @c shell, and your system understands the @env{TERMCAP} variable,
@@ -1148,7 +1215,7 @@ off directory tracking.
 
 @end ignore
 
-@node Emacs Server, Hardcopy, Shell, Top
+@node Emacs Server, Printing, Shell, Top
 @section Using Emacs as a Server
 @pindex emacsclient
 @cindex Emacs as a server
@@ -1210,6 +1277,14 @@ kills it if the file name matches the regular expression
   If you set the variable @code{server-window} to a window or a frame,
 @kbd{C-x #} displays the server buffer in that window or in that frame.
 
+@vindex server-name
+  You can run multiple Emacs servers on the same machine by giving
+each one a unique ``server name'', using the variable
+@code{server-name}.  For example, @kbd{M-x set-variable @key{RET}
+server-name @key{RET} foo @key{RET}} sets the server name to
+@samp{foo}.  The @code{emacsclient} program can visit a server by name
+using the @samp{-s} option.  @xref{Invoking emacsclient}.
+
   While @code{mail} or another application is waiting for
 @code{emacsclient} to finish, @code{emacsclient} does not read terminal
 input.  So the terminal that @code{mail} was using is effectively
@@ -1240,11 +1315,11 @@ in Emacs.  Note that server buffers created in this way are not killed
 automatically when you finish with them.
 
 @menu
-* Invoking emacsclient::
+* Invoking emacsclient:: Emacs client startup options.
 @end menu
 
 @node Invoking emacsclient,, Emacs Server, Emacs Server
-@section Invoking @code{emacsclient}
+@subsection Invoking @code{emacsclient}
 
   To run the @code{emacsclient} program, specify file names as arguments,
 and optionally line numbers as well.  Do it like this:
@@ -1272,10 +1347,10 @@ long as you like to edit the files in Emacs.)
 running @code{emacsclient} in a script.  It specifies a command to run
 if @code{emacsclient} fails to contact Emacs.  For example, the
 following setting for the @var{EDITOR} environment variable will
-always give an editor, even if Emacs is not running:
+always give you an editor, even if no Emacs server is running:
 
 @example
-EDITOR="emacsclient --alternate-editor vi +%d %s"
+EDITOR="emacsclient --alternate-editor emacs +%d %s"
 @end example
 
 @noindent
@@ -1287,14 +1362,30 @@ the value of the @samp{--alternate-editor} takes precedence.
 function which will communicate with a running Emacs server, or start
 one if none exists.
 
-@node Hardcopy, PostScript, Emacs Server, Top
-@section Hardcopy Output
+If you use several displays, you can tell Emacs on which display to
+open the given files with the option @samp{--display=@var{DISPLAY}}.
+This can be used typically when connecting from home to an Emacs
+server running on your machine at your workplace.
+
+If there is more than one Emacs server running, you can specify a
+server name with the option @samp{-s @var{name}}.
+
+You can also use @code{emacsclient} to execute any piece of Emacs Lisp
+code, using the option @samp{--eval}.  When this option is given, the
+rest of the arguments is not taken as a list of files to visit but as
+a list of expressions to evaluate.
+
+@node Printing, Sorting, Emacs Server, Top
+@section Printing Hard Copies
 @cindex hardcopy
+@cindex printing
 
-  The Emacs commands for making hardcopy let you print either an entire
-buffer or just part of one, either with or without page headers.
-See also the hardcopy commands of Dired (@pxref{Misc File Ops})
-and the diary (@pxref{Diary Commands}).
+  Emacs provides commands for printing hard copies of either an entire
+buffer or just part of one, with or without page headers.  You can
+invoke the printing commands directly, as detailed in the following
+section, or using the @samp{File} menu on the menu bar.  See also the
+hardcopy commands of Dired (@pxref{Misc File Ops}) and the diary
+(@pxref{Displaying the Diary}).
 
 @table @kbd
 @item M-x print-buffer
@@ -1341,7 +1432,13 @@ whether to supply @samp{-T} and @samp{-J} options (suitable for
 @code{lpr-add-switches} should be @code{nil} if your printer program is
 not compatible with @code{lpr}.
 
-@node PostScript, PostScript Variables, Hardcopy, Top
+@menu
+* PostScript::          Printing buffers or regions as PostScript.
+* PostScript Variables:: Customizing the PostScript printing commands.
+* Printing Package::     An optional advanced printing interface.
+@end menu
+
+@node PostScript, PostScript Variables,, Printing
 @section PostScript Hardcopy
 
   These commands convert buffer contents to PostScript,
@@ -1405,7 +1502,7 @@ supports ISO 8859-1 characters.
   The following section describes variables for customizing these commands.
 @end ifinfo
 
-@node PostScript Variables, Sorting, PostScript, Top
+@node PostScript Variables, Printing Package, PostScript, Printing
 @section Variables for PostScript Hardcopy
 
 @vindex ps-lpr-command
@@ -1479,13 +1576,13 @@ printable using the fonts built into your printer.  You can augment
 the fonts supplied with the printer with those from the GNU Intlfonts
 package, or you can instruct Emacs to use Intlfonts exclusively.  The
 variable @code{ps-multibyte-buffer} controls this: the default value,
-@code{nil}, is appropriate for printing ASCII and Latin-1
+@code{nil}, is appropriate for printing @acronym{ASCII} and Latin-1
 characters; a value of @code{non-latin-printer} is for printers which
-have the fonts for ASCII, Latin-1, Japanese, and Korean
+have the fonts for @acronym{ASCII}, Latin-1, Japanese, and Korean
 characters built into them.  A value of @code{bdf-font} arranges for
 the BDF fonts from the Intlfonts package to be used for @emph{all}
 characters.  Finally, a value of @code{bdf-font-except-latin}
-instructs the printer to use built-in fonts for ASCII and Latin-1
+instructs the printer to use built-in fonts for @acronym{ASCII} and Latin-1
 characters, and Intlfonts BDF fonts for the rest.
 
 @vindex bdf-directory-list
@@ -1497,18 +1594,45 @@ includes a single directory @file{/usr/local/share/emacs/fonts/bdf}.
   Many other customization variables for these commands are defined and
 described in the Lisp files @file{ps-print.el} and @file{ps-mule.el}.
 
-@node Sorting, Narrowing, PostScript Variables, Top
+@node Printing Package,, PostScript Variables, Printing
+@section Printing Package
+@cindex Printing package
+
+  The basic Emacs facilities for printing hardcopy can be extended
+using the Printing package.  This provides an easy-to-use interface
+for choosing what to print, previewing PostScript files before
+printing, and setting various printing options such as print headers,
+landscape or portrait modes, duplex modes, and so forth.  On GNU/Linux
+or Unix systems, the Printing package relies on the @file{gs} and
+@file{gv} utilities, which are distributed as part of the GhostScript
+program.  On MS-Windows, the @file{gstools} port of Ghostscript can be
+used.
+
+@findex pr-interface
+  To use the Printing package, add @code{(require 'printing)} to your
+init file (@pxref{Init File}), followed by @code{(pr-update-menus)}.
+This function replaces the usual printing commands in the menu bar
+with a @samp{Printing} submenu that contains various printing options.
+You can also type @kbd{M-x pr-interface RET}; this creates a
+@samp{*Printing Interface*} buffer, similar to a customization buffer,
+where you can set the printing options.  After selecting what and how
+to print, you start the print job using the @samp{Print} button (click
+@kbd{mouse-2} on it, or move point over it and type @kbd{RET}).  For
+further information on the various options, use the @samp{Interface
+Help} button.
+
+@node Sorting, Narrowing, Printing, Top
 @section Sorting Text
 @cindex sorting
 
   Emacs provides several commands for sorting text in the buffer.  All
-operate on the contents of the region (the text between point and the
-mark).  They divide the text of the region into many @dfn{sort records},
+operate on the contents of the region.
+They divide the text of the region into many @dfn{sort records},
 identify a @dfn{sort key} for each record, and then reorder the records
 into the order determined by the sort keys.  The records are ordered so
 that their keys are in alphabetical order, or, for numeric sorting, in
 numeric order.  In alphabetic sorting, all upper-case letters `A' through
-`Z' come before lower-case `a', in accord with the ASCII character
+`Z' come before lower-case `a', in accord with the @acronym{ASCII} character
 sequence.
 
   The various sort commands differ in how they divide the text into sort
@@ -1852,55 +1976,55 @@ hexl-@key{RET}} for details.
 @cindex reload files
 @cindex desktop
 
-  You can use the Desktop library to save the state of Emacs from one
-session to another.  Saving the state means that Emacs starts up with
-the same set of buffers, major modes, buffer positions, and so on that
-the previous Emacs session had.
+   Use the desktop library to save the state of Emacs from one session
+to another.  Once you save the Emacs @dfn{desktop}---the buffers,
+their file names, major modes, buffer positions, and so on---then
+subsequent Emacs sessions reload the saved desktop.
 
-@vindex desktop-enable
-  To use Desktop, you should use the Customization buffer (@pxref{Easy
-Customization}) to set @code{desktop-enable} to a non-@code{nil} value,
-or add these lines at the end of your @file{.emacs} file:
+@findex desktop-save
+@vindex desktop-save-mode
+  You can save the desktop manually with the command @kbd{M-x
+desktop-save}.  You can also enable automatic desktop saving when
+you exit Emacs: use the Customization buffer (@pxref{Easy
+Customization}) to set @code{desktop-save-mode} to @code{t} for future
+sessions, or add this line in your @file{~/.emacs} file:
 
 @example
-(desktop-load-default)
-(desktop-read)
+(desktop-save-mode 1)
 @end example
 
-@noindent
-@findex desktop-save
-The first time you save the state of the Emacs session, you must do it
-manually, with the command @kbd{M-x desktop-save}.  Once you have done
-that, exiting Emacs will save the state again---not only the present
-Emacs session, but also subsequent sessions.  You can also save the
-state at any time, without exiting Emacs, by typing @kbd{M-x
-desktop-save} again.
-
-  In order for Emacs to recover the state from a previous session, you
-must start it with the same current directory as you used when you
-started the previous session.  This is because @code{desktop-read} looks
-in the current directory for the file to read.  This means that you can
-have separate saved sessions in different directories; the directory in
-which you start Emacs will control which saved session to use.
-
-@vindex desktop-files-not-to-save
-  The variable @code{desktop-files-not-to-save} controls which files are
-excluded from state saving.  Its value is a regular expression that
-matches the files to exclude.  By default, remote (ftp-accessed) files
-are excluded; this is because visiting them again in the subsequent
-session would be slow.  If you want to include these files in state
-saving, set @code{desktop-files-not-to-save} to @code{"^$"}.
-@xref{Remote Files}.
-
-@vindex save-place
-@cindex Saveplace
-@findex toggle-save-place
-  The Saveplace library provides a simpler feature that records your
-position in each file when you kill its buffer (or kill Emacs), and
-jumps to the same position when you visit the file again (even in
-another Emacs session).  Use @kbd{M-x toggle-save-place} to turn on
-place-saving in a given file.  Customize the option @code{save-place}
-to turn it on for all files in each session.
+@findex desktop-change-dir
+@findex desktop-revert
+  When Emacs starts, it looks for a saved desktop in the current
+directory.  Thus, you can have separate saved desktops in different
+directories, and the starting directory determines which one Emacs
+reloads.  You can save the current desktop and reload one saved in
+another directory by typing @kbd{M-x desktop-change-dir}.  Typing
+@kbd{M-x desktop-revert} reverts to the desktop previously reloaded.
+
+  Specify the option @samp{--no-desktop} on the command line when you
+don't want it to reload any saved desktop.  This turns off
+@code{desktop-save-mode} for the current session.
+
+@vindex desktop-restore-eager
+  By default, all the buffers in the desktop are restored at one go.
+However, this may be slow if there are a lot of buffers in the
+desktop.  You can specify the maximum number of buffers to restore
+immediately with the variable @code{desktop-restore-eager}; the
+remaining buffers are restored ``lazily,'' when Emacs is idle.
+
+@findex desktop-clear
+@vindex desktop-globals-to-clear
+@vindex desktop-clear-preserve-buffers-regexp
+  Type @kbd{M-x desktop-clear} to empty the Emacs desktop.  This kills
+all buffers except for internal ones, and clears the global variables
+listed in @code{desktop-globals-to-clear}.  If you want this to
+preserve certain buffers, customize the variable
+@code{desktop-clear-preserve-buffers-regexp}, whose value is a regular
+expression matching the names of buffers not to kill.
+
+  If you want to save minibuffer history from one session to
+another, use the @code{savehist} library.
 
 @node Recursive Edit, Emulation, Saving Emacs Sessions, Top
 @section Recursive Editing Levels
@@ -1938,7 +2062,7 @@ for the debugger, within the recursive editing level for @kbd{C-r}.
 Mode lines display a pair of square brackets for each recursive editing
 level currently in progress.
 
-  Exiting the inner recursive edit (such as, with the debugger @kbd{c}
+  Exiting the inner recursive edit (such as with the debugger @kbd{c}
 command) resumes the command running in the next level up.  When that
 command finishes, you can then use @kbd{C-M-c} to exit another recursive
 editing level, and so on.  Exiting applies to the innermost level only.
@@ -1996,8 +2120,8 @@ editors.  Standard facilities can emulate these:
 @cindex mode, CRiSP
 You can turn on key bindings to emulate the CRiSP/Brief editor with
 @kbd{M-x crisp-mode}.  Note that this rebinds @kbd{M-x} to exit Emacs
-unless you change the user option @code{crisp-override-meta-x}.  You can
-also use the command @kbd{M-x scroll-all-mode} or set the user option
+unless you set the variable @code{crisp-override-meta-x}.  You can
+also use the command @kbd{M-x scroll-all-mode} or set the variable
 @code{crisp-load-scroll-all} to emulate CRiSP's scroll-all feature
 (scrolling all windows together).
 
@@ -2012,46 +2136,6 @@ Emacs key bindings are still available.  The EDT emulation rebindings
 are done in the global keymap, so there is no problem switching
 buffers or major modes while in EDT emulation.
 
-@item ``PC'' bindings
-@findex pc-bindings-mode
-@cindex ``PC'' key bindings
-The command @kbd{M-x pc-bindings-mode} sets up certain key bindings
-for ``PC compatibility''---what people are often used to on PCs---as
-follows: @kbd{Delete} and its variants delete forward instead of
-backward, @kbd{C-Backspace} kills backward a word (as @kbd{C-Delete}
-normally would), @kbd{M-Backspace} does undo, @kbd{Home} and @kbd{End}
-move to beginning and end of line, @kbd{C-Home} and @kbd{C-End} move
-to beginning and end of buffer and @kbd{C-Escape} does
-@code{list-buffers}.
-
-@item PC Selection mode
-@findex pc-selection-mode
-@cindex PC Selection minor mode
-@cindex mode, PC selection
-@cindex selection, PC
-The command @kbd{M-x pc-selection-mode} toggles a global minor mode
-that emulates the mark, copy, cut and paste commands of various other
-systems---an interface known as CUA.  It establishes the key bindings
-of PC mode, and also modifies the bindings of the cursor keys and the
-@kbd{next}, @kbd{prior}, @kbd{home} and @kbd{end} keys.  It does not
-provide the full set of CUA key bindings---the fundamental Emacs keys
-@kbd{C-c}, @kbd{C-v} and @kbd{C-x} are not changed.
-
-The standard keys for moving around (@kbd{right}, @kbd{left},
-@kbd{up}, @kbd{down}, @kbd{home}, @kbd{end}, @kbd{prior}, @kbd{next},
-called ``move-keys'') deactivate the mark in PC selection mode.
-However, using @kbd{Shift} together with the ``move keys'' activates
-the region over which they move.  The copy, cut and paste functions
-are available on @kbd{C-insert}, @kbd{S-delete} and @kbd{S-insert}
-respectively.
-
-Turning @code{pc-selection-mode} off restores the old key bindings of
-these keys.
-
-@cindex s-region package
-The @code{s-region} package provides similar, but less complete,
-facilities.
-
 @item TPU (DEC VMS editor)
 @findex tpu-edt-on
 @cindex TPU
@@ -2108,9 +2192,13 @@ key bindings.
 @cindex navigation
   Various modes documented elsewhere have hypertext features so that
 you can follow links, usually by clicking @kbd{Mouse-2} on the link or
-typing @key{RET} while point is on the link.  Info mode, Help mode and
-the Dired-like modes are examples.  The Tags facility links between
-uses and definitions in source files, see @ref{Tags}.  Imenu provides
+typing @key{RET} while point is on the link.  Clicking @kbd{Mouse-1}
+quickly on the link also follows it.  (Hold @kbd{Mouse-1} for longer
+if you want to set point instead.)
+
+  Info mode, Help mode and the Dired-like modes are examples of modes
+that have links in the buffer.  The Tags facility links between uses
+and definitions in source files, see @ref{Tags}.  Imenu provides
 navigation amongst items indexed in the current buffer, see
 @ref{Imenu}.  Info-lookup provides mode-specific lookup of definitions
 in Info indexes, see @ref{Documentation}.  Speedbar maintains a frame
@@ -2125,7 +2213,6 @@ fashion.
 * Browse-URL::                  Following URLs.
 * Goto-address::                Activating URLs.
 * FFAP::                        Finding files etc. at point.
-* Find-func::                   Finding function and variable definitions.
 @end menu
 
 @node Browse-URL
@@ -2160,9 +2247,10 @@ which you might like to bind to keys, such as
 @code{browse-url-browser-function}.  You can invoke actions dependent
 on the type of URL by defining @code{browse-url-browser-function} as
 an association list.  The package's commentary available via @kbd{C-h
-p} provides more information.  Packages with facilities for following
-URLs should always go through Browse-URL, so that the customization
-options for Browse-URL will affect all browsing in Emacs.
+p} under the @samp{hypermedia} keyword provides more information.
+Packages with facilities for following URLs should always go through
+Browse-URL, so that the customization options for Browse-URL will
+affect all browsing in Emacs.
 
 @node Goto-address
 @subsection Activating URLs
@@ -2194,7 +2282,7 @@ which has a similar feature of its own.
 @subsection Finding Files and URLs at Point
 @findex find-file-at-point
 @findex ffap
-@findex ffap-dired-at-point
+@findex dired-at-point
 @findex ffap-next
 @findex ffap-menu
 @cindex finding file at point
@@ -2209,32 +2297,50 @@ view it.
 
   This feature is useful for following references in mail or news
 buffers, @file{README} files, @file{MANIFEST} files, and so on.  The
-@samp{ffap} package's commentary available via @kbd{C-h p} and the
-@code{ffap} Custom group provide details.
+@samp{ffap} package's commentary available via @kbd{C-h p} under the
+@samp{files} keyword and the @code{ffap} Custom group provide details.
 
 @cindex FFAP minor mode
 @findex ffap-mode
-  You can turn on FFAP minor mode to make the following key bindings
-and to install hooks for using @code{ffap} in Rmail, Gnus and VM
-article buffers.
+  You can turn on FFAP minor mode by calling @code{ffap-bindings} to
+make the following key bindings and to install hooks for using
+@code{ffap} in Rmail, Gnus and VM article buffers.
 
 @table @kbd
 @item C-x C-f @var{filename} @key{RET}
 @kindex C-x C-f @r{(FFAP)}
 Find @var{filename}, guessing a default from text around point
 (@code{find-file-at-point}).
+@item C-x C-r
+@kindex C-x C-r @r{(FFAP)}
+@code{ffap-read-only}, analogous to @code{find-file-read-only}.
+@item C-x C-v
+@kindex C-x C-v @r{(FFAP)}
+@code{ffap-alternate-file}, analogous to @code{find-alternate-file}.
+@item C-x d @var{directory} @key{RET}
+@kindex C-x d @r{(FFAP)}
+Start Dired on @var{directory}, defaulting to the directory name at
+point (@code{dired-at-point}).
+@item C-x C-d
+@code{ffap-list-directory}, analogous to @code{list-directory}.
 @item C-x 4 f
 @kindex C-x 4 f @r{(FFAP)}
 @code{ffap-other-window}, analogous to @code{find-file-other-window}.
+@item C-x 4 r
+@code{ffap-read-only-other-window}, analogous to
+@code{find-file-read-only-other-window}.
+@item C-x 4 d
+@code{ffap-dired-other-window}, analogous to @code{dired-other-window}.
 @item C-x 5 f
 @kindex C-x 5 f @r{(FFAP)}
 @code{ffap-other-frame}, analogous to @code{find-file-other-frame}.
+@item C-x 5 r
+@code{ffap-read-only-other-frame}, analogous to
+@code{find-file-read-only-other-frame}.
+@item C-x 5 d
+@code{ffap-dired-other-frame}, analogous to @code{dired-other-frame}.
 @item M-x ffap-next
 Search buffer for next file name or URL, then find that file or URL.
-@item C-x d @var{directory} @key{RET}
-@kindex C-x d @r{(FFAP)}
-Start Dired on @var{directory}, defaulting to the directory name at
-point (@code{ffap-dired-at-point}).
 @item S-Mouse-3
 @kindex S-Mouse-3 @r{(FFAP)}
 @code{ffap-at-mouse} finds the file guessed from text around the position
@@ -2245,41 +2351,6 @@ Display a menu of files and URLs mentioned in current buffer, then
 find the one you select (@code{ffap-menu}).
 @end table
 
-@node Find-func
-@subsection Finding Function and Variable Definitions
-@cindex definitions, finding in Lisp sources
-@cindex Lisp definitions, finding in sources
-
-@table @kbd
-@item M-x find-function @key{RET} @var{function} @key{RET}
-Find the definition of @var{function} in its source file.
-@item M-x find-variable @key{RET} @var{variable} @key{RET}
-Find the definition of @var{variable} in its source file.
-@item M-x find-function-on-key @key{RET} @var{key}
-Find the definition of the function that @var{key} invokes.
-@end table
-
-  These commands provide an easy way to find the definitions of Emacs
-Lisp functions and variables.  They are similar in purpose to the Tags
-facility (@pxref{Tags}), but don't require a tags table; on the other
-hand, they only work for function and variable definitions that are
-already loaded in the Emacs session.
-
-@findex find-function
-@findex find-function-on-key
-@findex find-variable
-  To find the definition of a function, use @kbd{M-x find-function}.
-@kbd{M-x find-variable} finds the definition of a specified variable.
-@kbd{M-x find-function-on-key} finds the definition of the function
-bound to a specified key.
-
-  To use these commands, you must have the Lisp source (@samp{.el})
-files available along with the compiled (@samp{.elc}) files, in
-directories in @code{load-path}.  You can use compressed source files
-if you enable Auto Compression mode.  These commands only handle
-definitions written in Lisp, not primitive functions or variables
-defined in the C code of Emacs.
-
 @node Dissociated Press, Amusements, Hyperlinking, Top
 @section Dissociated Press
 
@@ -2427,3 +2498,11 @@ Likewise, @kbd{M-x snake} provides an implementation of Snake.
 @findex zone
 The command @kbd{M-x zone} plays games with the display when Emacs is
 idle.
+
+@ifnottex
+@lowersections
+@end ifnottex
+
+@ignore
+   arch-tag: 8f094220-c0d5-4e9e-af7d-3e0da8187474
+@end ignore