]> code.delx.au - gnu-emacs/blobdiff - doc/emacs/mini.texi
Update copyright year to 2015
[gnu-emacs] / doc / emacs / mini.texi
index f50e3085f2df167c694188adfbc2dbcbfae884b7..2a86af3ec2f15a24bd6a3365e31a5fecca3f9b2c 100644 (file)
@@ -1,8 +1,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-2015 Free Software
+@c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Minibuffer, M-x, Basic, Top
+@node Minibuffer
 @chapter The Minibuffer
 @cindex minibuffer
 
@@ -13,24 +13,54 @@ special-purpose buffer with a small amount of screen space.  You can
 use the usual Emacs editing commands in the minibuffer to edit the
 argument text.
 
+@menu
+* Basic Minibuffer::      Basic usage of the minibuffer.
+* Minibuffer File::       Entering file names with the minibuffer.
+* Minibuffer Edit::       How to edit in the minibuffer.
+* Completion::            An abbreviation facility for minibuffer input.
+* Minibuffer History::    Reusing recent minibuffer arguments.
+* Repetition::            Re-executing commands that used the minibuffer.
+* Passwords::             Entering passwords in the echo area.
+* Yes or No Prompts::     Replying yes or no in the echo area.
+@end menu
+
+@node Basic Minibuffer
+@section Using the Minibuffer
+
 @cindex prompt
   When the minibuffer is in use, it appears in the echo area, with a
-cursor.  The minibuffer starts with a @dfn{prompt} in a distinct
-color, usually ending with a colon.  The prompt states what kind of
-input is expected, and how it will be used.
+cursor.  The minibuffer starts with a @dfn{prompt}, usually ending
+with a colon.  The prompt states what kind of input is expected, and
+how it will be used.  The prompt is highlighted using the
+@code{minibuffer-prompt} face (@pxref{Faces}).
 
   The simplest way to enter a minibuffer argument is to type the text,
-then @key{RET} to submit the argument and exit the minibuffer.  You
-can cancel the minibuffer, and the command that wants the argument, by
-typing @kbd{C-g}.
+then @key{RET} to submit the argument and exit the minibuffer.
+Alternatively, you can type @kbd{C-g} to exit the minibuffer by
+canceling the command asking for the argument (@pxref{Quitting}).
 
 @cindex default argument
-  Sometimes, a @dfn{default argument} appears in the prompt, inside
+  Sometimes, the prompt shows a @dfn{default argument}, inside
 parentheses before the colon.  This default will be used as the
 argument if you just type @key{RET}.  For example, commands that read
 buffer names usually show a buffer name as the default; you can type
 @key{RET} to operate on that default buffer.
 
+@cindex Minibuffer Electric Default mode
+@cindex mode, Minibuffer Electric Default
+@findex minibuffer-electric-default-mode
+@vindex minibuffer-eldef-shorten-default
+  If you enable Minibuffer Electric Default mode, a global minor mode,
+Emacs hides the default argument as soon as you modify the contents of
+the minibuffer (since typing @key{RET} would no longer submit that
+default).  If you ever bring back the original minibuffer text, the
+prompt again shows the default.  Furthermore, if you change the
+variable @code{minibuffer-eldef-shorten-default} to a non-@code{nil}
+value, the default argument is displayed as @samp{[@var{default}]}
+instead of @samp{(default @var{default})}, saving some screen space.
+To enable this minor mode, type @kbd{M-x
+minibuffer-electric-default-mode}.
+
   Since the minibuffer appears in the echo area, it can conflict with
 other uses of the echo area.  If an error message or an informative
 message is emitted while the minibuffer is active, the message hides
@@ -38,15 +68,6 @@ the minibuffer for a few seconds, or until you type something; then
 the minibuffer comes back.  While the minibuffer is in use, keystrokes
 do not echo.
 
-@menu
-* Minibuffer File::       Entering file names with the minibuffer.
-* Minibuffer Edit::       How to edit in the minibuffer.
-* Completion::            An abbreviation facility for minibuffer input.
-* Minibuffer History::    Reusing recent minibuffer arguments.
-* Repetition::            Re-executing commands that used the minibuffer.
-* Passwords::             Entering passwords in the echo area.
-@end menu
-
 @node Minibuffer File
 @section Minibuffers for File Names
 
@@ -336,12 +357,12 @@ While in the completion list buffer, this chooses the completion at
 point (@code{choose-completion}).
 
 @findex next-completion
-@item @key{Right}
+@item @key{RIGHT}
 While in the completion list buffer, this moves point to the following
 completion alternative (@code{next-completion}).
 
 @findex previous-completion
-@item @key{Left}
+@item @key{LEFT}
 While in the completion list buffer, this moves point to the previous
 completion alternative (@code{previous-completion}).
 @end table
@@ -529,6 +550,9 @@ previous example, @samp{foo.e} completes to @samp{foo.elc}.  Emacs
 disregards @code{completion-ignored-extensions} when showing
 completion alternatives in the completion list.
 
+  Shell completion is an extended version of filename completion,
+@pxref{Shell Options}.
+
 @vindex completion-auto-help
   If @code{completion-auto-help} is set to @code{nil}, the completion
 commands never display the completion list buffer; you must type
@@ -549,14 +573,7 @@ those completion alternatives; each subsequent invocation of the
 completion command replaces that with the next completion alternative,
 in a cyclic manner.  If you give @code{completion-cycle-threshold} a
 numeric value @var{n}, completion commands switch to this cycling
-behavior only when there are fewer than @var{n} alternatives.
-
-@cindex Icomplete mode
-@findex icomplete-mode
-  Icomplete mode presents a constantly-updated display that tells you
-what completions are available for the text you've entered so far.  The
-command to enable or disable this minor mode is @kbd{M-x
-icomplete-mode}.
+behavior only when there are @var{n} or fewer alternatives.
 
 @node Minibuffer History
 @section Minibuffer History
@@ -570,11 +587,11 @@ argument into the minibuffer:
 
 @table @kbd
 @item M-p
-@itemx @key{Up}
+@itemx @key{UP}
 Move to the previous item in the minibuffer history, an earlier
 argument (@code{previous-history-element}).
 @item M-n
-@itemx @key{Down}
+@itemx @key{DOWN}
 Move to the next item in the minibuffer history
 (@code{next-history-element}).
 @item M-r @var{regexp} @key{RET}
@@ -591,11 +608,11 @@ Move to a later item in the minibuffer history that matches
 @kindex DOWN @r{(minibuffer history)}
 @findex next-history-element
 @findex previous-history-element
-  While in the minibuffer, @kbd{M-p} or @key{Up}
+  While in the minibuffer, @kbd{M-p} or @key{UP}
 (@code{previous-history-element}) moves through the minibuffer history
 list, one item at a time.  Each @kbd{M-p} fetches an earlier item from
 the history list into the minibuffer, replacing its existing contents.
-Typing @kbd{M-n} or @key{Down} (@code{next-history-element}) moves
+Typing @kbd{M-n} or @key{DOWN} (@code{next-history-element}) moves
 through the minibuffer history list in the opposite direction,
 fetching later entries into the minibuffer.
 
@@ -682,13 +699,13 @@ the text for that expression.  Even if you don't know Lisp, it will
 probably be obvious which command is displayed for repetition.  If you
 type just @key{RET}, that repeats the command unchanged.  You can also
 change the command by editing the Lisp expression before you execute
-it.  The repeated command is added to the front of the command history
+it.  The executed command is added to the front of the command history
 unless it is identical to the most recent item.
 
   Once inside the minibuffer for @kbd{C-x @key{ESC} @key{ESC}}, you
 can use the usual minibuffer history commands (@pxref{Minibuffer
 History}) to move through the history list.  After finding the desired
-previous command, you can edit its expression as usual and then repeat
+previous command, you can edit its expression as usual and then execute
 it by typing @key{RET}.
 
 @vindex isearch-resume-in-command-history
@@ -726,10 +743,60 @@ completion, and you cannot change windows or perform any other action
 with Emacs until you have submitted the password.
 
   While you are typing the password, you may press @key{DEL} to delete
-backwards, removing the last character entered.  @key{C-u} deletes
+backwards, removing the last character entered.  @kbd{C-u} deletes
 everything you have typed so far.  @kbd{C-g} quits the password prompt
 (@pxref{Quitting}).  @kbd{C-y} inserts the current kill into the
 password (@pxref{Killing}).  You may type either @key{RET} or
 @key{ESC} to submit the password.  Any other self-inserting character
 key inserts the associated character into the password, and all other
 input is ignored.
+
+@node Yes or No Prompts
+@section Yes or No Prompts
+
+  An Emacs command may require you to answer a ``yes or no'' question
+during the course of its execution.  Such queries come in two main
+varieties.
+
+@cindex y or n prompt
+  For the first type of ``yes or no'' query, the prompt ends with
+@samp{(y or n)}.  Such a query does not actually use the minibuffer;
+the prompt appears in the echo area, and you answer by typing either
+@samp{y} or @samp{n}, which immediately delivers the response.  For
+example, if you type @kbd{C-x C-w} (@kbd{write-file}) to save a
+buffer, and enter the name of an existing file, Emacs issues a prompt
+like this:
+
+@smallexample
+File `foo.el' exists; overwrite? (y or n)
+@end smallexample
+
+@noindent
+Because this query does not actually use the minibuffer, the usual
+minibuffer editing commands cannot be used.  However, you can perform
+some window scrolling operations while the query is active: @kbd{C-l}
+recenters the selected window; @kbd{M-v} (or @key{PageDown} or
+@key{next}) scrolls forward; @kbd{C-v} (or @key{PageUp}, or
+@key{prior}) scrolls backward; @kbd{C-M-v} scrolls forward in the next
+window; and @kbd{C-M-S-v} scrolls backward in the next window.  Typing
+@kbd{C-g} dismisses the query, and quits the command that issued it
+(@pxref{Quitting}).
+
+@cindex yes or no prompt
+  The second type of ``yes or no'' query is typically employed if
+giving the wrong answer would have serious consequences; it uses the
+minibuffer, and features a prompt ending with @samp{(yes or no)}.  For
+example, if you invoke @kbd{C-x k} (@code{kill-buffer}) on a
+file-visiting buffer with unsaved changes, Emacs activates the
+minibuffer with a prompt like this:
+
+@smallexample
+Buffer foo.el modified; kill anyway? (yes or no)
+@end smallexample
+
+@noindent
+To answer, you must type @samp{yes} or @samp{no} into the minibuffer,
+followed by @key{RET}.  The minibuffer behaves as described in the
+previous sections; you can switch to another window with @kbd{C-x o},
+use the history commands @kbd{M-p} and @kbd{M-f}, etc.  Type @kbd{C-g}
+to quit the minibuffer and the querying command.