aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/emacs/mini.texi424
1 files changed, 207 insertions, 217 deletions
diff --git a/doc/emacs/mini.texi b/doc/emacs/mini.texi
index 8510fea9b94..905c026577e 100644
--- a/doc/emacs/mini.texi
+++ b/doc/emacs/mini.texi
@@ -7,57 +7,42 @@
7@cindex minibuffer 7@cindex minibuffer
8 8
9 The @dfn{minibuffer} is where Emacs commands read complicated 9 The @dfn{minibuffer} is where Emacs commands read complicated
10arguments (anything more a single number). We call it the 10arguments, such as file names, buffer names, Emacs command names, or
11``minibuffer'' because it's a special-purpose buffer with a small 11Lisp expressions. We call it the ``minibuffer'' because it's a
12amount of screen space. Minibuffer arguments can be file names, 12special-purpose buffer with a small amount of screen space. You can
13buffer names, Lisp function names, Emacs command names, Lisp 13use the usual Emacs editing commands in the minibuffer to edit the
14expressions, and many other things---whatever the command wants to 14argument text.
15read. You can use the usual Emacs editing commands in the minibuffer
16to edit the argument text.
17 15
18@cindex prompt 16@cindex prompt
19 When the minibuffer is in use, it appears in the echo area, with a 17 When the minibuffer is in use, it appears in the echo area, with a
20cursor. The minibuffer display starts with a @dfn{prompt} in a 18cursor. The minibuffer display starts with a @dfn{prompt} in a
21distinct color; it says what kind of input is expected and how it will 19distinct color, usually ending with a colon. The prompt states what
22be used. Often the prompt is derived from the name of the command 20kind of input is expected, and how it will be used.
23that is reading the argument. The prompt normally ends with a colon. 21
22 The simplest way to enter a minibuffer argument is to type the text,
23then @key{RET} to submit the argument and exit the minibuffer. You
24can cancel the minibuffer, and the command that wants the argument, by
25typing @kbd{C-g}.
24 26
25@cindex default argument 27@cindex default argument
26 Sometimes a @dfn{default argument} appears in the prompt, inside 28 Sometimes, a @dfn{default argument} appears in the prompt, inside
27parentheses before the colon. The default will be used as the 29parentheses before the colon. The default will be used as the
28argument value if you just type @key{RET}. For example, commands that 30argument value if you just type @key{RET}. For example, commands that
29read buffer names show a buffer name as the default. You can type 31read buffer names usually show a buffer name as the default; you can
30@key{RET} to operate on that default buffer. 32type @key{RET} to operate on that default buffer.
31
32 The simplest way to enter a minibuffer argument is to type the text,
33then @key{RET} to exit the minibuffer. You can cancel the minibuffer,
34and the command that wants the argument, by typing @kbd{C-g}.
35 33
36 Since the minibuffer appears in the echo area, it can conflict with 34 Since the minibuffer appears in the echo area, it can conflict with
37other uses of the echo area. Here is how Emacs handles such 35other uses of the echo area. If an error occurs while the minibuffer
38conflicts: 36is active, the error message hides the minibuffer for a few seconds,
39 37or until you type something; then the minibuffer comes back. If a
40@itemize @bullet 38command such as @kbd{C-x =} needs to display a message in the echo
41@item 39area, the message hides the minibuffer for a few seconds, or until you
42An error occurs while the minibuffer is active. 40type something; then the minibuffer comes back. While the minibuffer
43 41is in use, keystrokes do not echo.
44The error message hides the minibuffer for a few seconds, or until you
45type something. Then the minibuffer comes back.
46
47@item
48A command such as @kbd{C-x =} needs to display a message in the echo
49area.
50
51The message hides the minibuffer for a few seconds, or until you type
52something. Then the minibuffer comes back.
53
54@item
55Keystrokes don't echo while the minibuffer is in use.
56@end itemize
57 42
58@menu 43@menu
59* File: Minibuffer File. Entering file names with the minibuffer. 44* Minibuffer File:: Entering file names with the minibuffer.
60* Edit: Minibuffer Edit. How to edit in the minibuffer. 45* Minibuffer Edit:: How to edit in the minibuffer.
61* Completion:: An abbreviation facility for minibuffer input. 46* Completion:: An abbreviation facility for minibuffer input.
62* Minibuffer History:: Reusing recent minibuffer arguments. 47* Minibuffer History:: Reusing recent minibuffer arguments.
63* Repetition:: Re-executing commands that used the minibuffer. 48* Repetition:: Re-executing commands that used the minibuffer.
@@ -66,33 +51,31 @@ Keystrokes don't echo while the minibuffer is in use.
66@node Minibuffer File 51@node Minibuffer File
67@section Minibuffers for File Names 52@section Minibuffers for File Names
68 53
69 When you use the minibuffer to enter a file name, it starts out with 54 Commands such as @kbd{C-x C-f} (@code{find-file}) use the minibuffer
70some initial text---the @dfn{default directory}, ending in a slash. 55to read a file name argument (@pxref{Basic Files}). When the
71The file you specify will be in this directory unless you alter or 56minibuffer is used to read a file name, it typically starts out with
72replace it. 57some initial text---the @dfn{default directory}, which ends in a
73 58slash. For example, it may start out like this:
74@c Separate paragraph to clean up ugly page break--rms
75@need 1500
76 For example, if the minibuffer starts out with these contents:
77 59
78@example 60@example
79Find File: /u2/emacs/src/ 61Find File: /u2/emacs/src/
80@end example 62@end example
81 63
82@noindent 64@noindent
83(where @samp{Find File:@: } is the prompt), and you type 65Here, @samp{Find File:@: } is the prompt and @samp{/u2/emacs/src/} is
84@kbd{buffer.c} as input, that specifies the file 66the default directory. If you now type @kbd{buffer.c} as input, that
85@file{/u2/emacs/src/buffer.c}. You can specify the parent directory 67specifies the file @file{/u2/emacs/src/buffer.c}.
86by adding @file{..}; thus, if you type @kbd{../lisp/simple.el}, you 68
87will get @file{/u2/emacs/lisp/simple.el}. Alternatively, you can use 69 You can specify the parent directory by adding @file{..}: for
88@kbd{M-@key{DEL}} to kill the directory names you don't want 70example, @file{/u2/emacs/src/../lisp/simple.el} is equivalent to
89(@pxref{Words}). 71@file{/u2/emacs/lisp/simple.el}. Alternatively, you can use
90 72@kbd{M-@key{DEL}} to kill directory names backwards (@pxref{Words}).
91 You can kill the entire default with @kbd{C-a C-k}, but there's no 73
92need to do that. It's easier to ignore the default, and enter an 74 To specify a file in a completely different directory, you can kill
93absolute file name starting with a slash or a tilde after the default 75the entire default with @kbd{C-a C-k} (@pxref{Minibuffer Edit}).
94directory. For example, to specify @file{/etc/termcap}, just type 76Alternatively, you can ignore the default, and enter an absolute file
95that name: 77name starting with a slash or a tilde after the default directory.
78For example, you can specify @file{/etc/termcap} as follows:
96 79
97@example 80@example
98Find File: /u2/emacs/src//etc/termcap 81Find File: /u2/emacs/src//etc/termcap
@@ -103,59 +86,74 @@ Find File: /u2/emacs/src//etc/termcap
103@cindex double slash in file name 86@cindex double slash in file name
104@cindex slashes repeated in file name 87@cindex slashes repeated in file name
105@findex file-name-shadow-mode 88@findex file-name-shadow-mode
106GNU Emacs interprets a double slash (which is not normally useful in 89Emacs interprets a double slash as ``ignore everything before the
107file names) as, ``ignore everything before the second slash in the 90second slash in the pair.'' In the example above,
108pair.'' In the example above. @samp{/u2/emacs/src/} is ignored, so 91@samp{/u2/emacs/src/} is ignored, so the argument you supplied is
109you get @file{/etc/termcap}. The ignored part of the file name is 92@file{/etc/termcap}. Similarly, Emacs interprets a tilde (@samp{~})
110dimmed if the terminal allows it; to disable this dimming, turn off 93as your home directory, ignoring everything before the tilde.
111File Name Shadow mode (a minor mode) with the command 94
112@kbd{M-x file-name-shadow-mode}. 95 The ignored part of the file name is dimmed if the terminal allows
113 96it. To disable this dimming, turn off File Name Shadow mode, a minor
114 If the variable @code{insert-default-directory} is @code{nil}, the 97mode, with the command @kbd{M-x file-name-shadow-mode}.
115default directory is never inserted in the minibuffer---so the 98
116minibuffer starts out empty. Nonetheless, relative file name 99 To prevent Emacs from inserting the default directory when reading
117arguments are still interpreted based on the same default directory. 100file names, change the variable @code{insert-default-directory} to
101@code{nil}. In that case, the minibuffer starts out empty.
102Nonetheless, relative file name arguments are still interpreted based
103on the same default directory.
118 104
119@node Minibuffer Edit 105@node Minibuffer Edit
120@section Editing in the Minibuffer 106@section Editing in the Minibuffer
121 107
122 The minibuffer is an Emacs buffer (albeit a peculiar one), and the 108 The minibuffer is an Emacs buffer, albeit a peculiar one, and the
123usual Emacs commands are available for editing the argument text. 109usual Emacs commands are available for editing the argument text.
110(The prompt, however, is @dfn{read-only}, and cannot be changed.)
124 111
125 Since @key{RET} in the minibuffer is defined to exit the minibuffer, 112 Since @key{RET} in the minibuffer is defined to exit the minibuffer,
126you can't use it to insert a newline in the minibuffer. To do that, 113you can't use it to insert a newline in the minibuffer. To do that,
127type @kbd{C-o} or @kbd{C-q C-j}. (The newline character is really the 114type @kbd{C-o} or @kbd{C-q C-j}. (The newline character is really the
128@acronym{ASCII} character control-J.) 115@acronym{ASCII} character control-J.)
129 116
130 The minibuffer has its own window, which normally has space in the 117 Inside a minibuffer, the keys @kbd{@key{TAB}}, @kbd{@key{SPC}}, and
131frame at all times, but it only acts like an Emacs window when the 118@kbd{@key{?}} are often bound to commands that perform
132minibuffer is active. When active, this window is much like any other 119@dfn{completion}. @xref{Completion}. You can use @kbd{C-q}
133Emacs window; for instance, you can switch to another window (with 120(@code{quoted-insert}) to insert a @key{TAB}, @key{SPC}, or @key{?}
134@kbd{C-x o}), edit text there, then return to the minibuffer window to 121character. For example, @kbd{C-q @key{TAB}} inserts a @key{TAB}
135finish the argument. You can even kill text in another window, return 122character. @xref{Inserting Text}.
136to the minibuffer window, and then yank the text into the argument. 123
137@xref{Windows}. 124 For convenience, @kbd{C-a} (@code{move-beginning-of-line}) in a
125minibuffer moves point to the beginning of the argument text, not the
126beginning of the prompt. For example, this allows you to erase the
127entire argument with @kbd{C-a C-k}.
138 128
139@cindex height of minibuffer 129@cindex height of minibuffer
140@cindex size of minibuffer 130@cindex size of minibuffer
141@cindex growing minibuffer 131@cindex growing minibuffer
142@cindex resizing minibuffer 132@cindex resizing minibuffer
143 There are some restrictions on the minibuffer window, however: you 133 When the minibuffer is active, the echo area is treated much like an
144cannot kill it, or split it, or switch buffers in it---the minibuffer 134ordinary Emacs window. For instance, you can switch to another window
145and its window are permanently attached. 135(with @kbd{C-x o}), edit text there, then return to the minibuffer
136window to finish the argument. You can even kill text in another
137window, return to the minibuffer window, and yank the text into the
138argument. There are some restrictions on the minibuffer window,
139however: for instance, you cannot split it. @xref{Windows}.
146 140
147@vindex resize-mini-windows 141@vindex resize-mini-windows
148 The minibuffer window expands vertically as necessary to hold the 142 Normally, the minibuffer window occupies a single screen line.
149text that you put in the minibuffer. If @code{resize-mini-windows} is 143However, if you add two or more lines' worth of text into the
150@code{t}, the window always resizes as needed by its contents. If its 144minibuffer, it expands automatically to accomodate the text. The
151value is the symbol @code{grow-only} (the default), the window grows 145variable @code{resize-mini-windows} controls the resizing of the
152automatically as needed, but shrinks (back to the normal size) only 146minibuffer. The default value is @code{grow-only}, which means the
153when the minibuffer becomes inactive. If its value is @code{nil}, you 147behavior we have just described. If the value is @code{t}, the
154have to adjust the height yourself. 148minibuffer window will also shrink automatically if you remove some
149lines of text from the minibuffer, down to a minimum of one screen
150line. If the value is @code{nil}, the minibuffer window never changes
151size automatically, but you can use the usual window-resizing commands
152on it (@pxref{Windows}).
155 153
156@vindex max-mini-window-height 154@vindex max-mini-window-height
157 The variable @code{max-mini-window-height} controls the maximum 155 The variable @code{max-mini-window-height} controls the maximum
158height for resizing the minibuffer window: a floating-point number 156height for resizing the minibuffer window. A floating-point number
159specifies a fraction of the frame's height; an integer specifies the 157specifies a fraction of the frame's height; an integer specifies the
160maximum number of lines; @code{nil} means do not resize the minibuffer 158maximum number of lines; @code{nil} means do not resize the minibuffer
161window automatically. The default value is 0.25. 159window automatically. The default value is 0.25.
@@ -168,47 +166,40 @@ completions. @xref{Other Window}.
168 166
169@vindex enable-recursive-minibuffers 167@vindex enable-recursive-minibuffers
170 Emacs normally disallows most commands that use the minibuffer while 168 Emacs normally disallows most commands that use the minibuffer while
171the minibuffer is active. (Entering the minibuffer from the 169the minibuffer is active. To allow such commands in the minibuffer,
172minibuffer can be confusing.) To allow such commands in the 170set the variable @code{enable-recursive-minibuffers} to @code{t}.
173minibuffer, set the variable @code{enable-recursive-minibuffers} to
174@code{t}.
175 171
176@node Completion 172@node Completion
177@section Completion 173@section Completion
178@c This node is referenced in the tutorial. When renaming or deleting 174@c This node is referenced in the tutorial. When renaming or deleting
179@c it, the tutorial needs to be adjusted. 175@c it, the tutorial needs to be adjusted.
180@cindex completion 176@cindex completion
181 177
182 Some arguments allow @dfn{completion} to enter their value. This 178 Sometimes, you can use a feature called @dfn{completion} to help you
183means that after you type part of the argument, Emacs can fill in the 179enter arguments. This means that after you type part of the argument,
184rest, or some of it, based on what you have typed so far. 180Emacs can fill in the rest, or some of it, based on what you have
185 181typed so far.
186 When completion is available, certain keys---@key{TAB}, @key{RET}, 182
187and @key{SPC}---are rebound to complete the text in the minibuffer 183 When completion is available, certain keys (usually @key{TAB},
188before point into a longer string chosen from a set of @dfn{completion 184@key{RET}, and @key{SPC}) are rebound to complete the text in the
189alternatives} provided by the command that requested the argument. 185minibuffer into a longer string chosen from a set of @dfn{completion
190(@key{SPC} does not do completion in reading file names, because it is 186alternatives}. The set of completion alternatives depends on the
191common to use spaces in file names on some systems.) @kbd{?} displays 187command that requested the argument, and on what you have typed so
192a list of the possible completions at any time. 188far. In addition, you can usually type @kbd{?} to display a list of
189possible completions.
193 190
194 For example, @kbd{M-x} uses the minibuffer to read the name of a 191 For example, @kbd{M-x} uses the minibuffer to read the name of a
195command, so it provides a list of all Emacs command names for 192command, so completion works by matching the minibuffer text against
196completion candidates. The completion keys match the minibuffer text 193the names of existing Emacs commands. So, to run the command
197against these candidates, find any additional name characters implied 194@code{insert-buffer}, you can type @kbd{M-x ins @key{SPC} b @key{RET}}
198by the text already present in the minibuffer, and add those 195instead of the full @kbd{M-x insert-buffer @key{RET}}.
199characters. This makes it possible to type @kbd{M-x ins @key{SPC} b
200@key{RET}} instead of @kbd{M-x insert-buffer @key{RET}}, for example.
201 196
202 Case is significant in completion when it is significant in the 197 Case is significant in completion when it is significant in the
203argument you are entering (buffer names, file names, command names, 198argument you are entering, such as command names. Thus,
204for instance). Thus, @samp{fo} does not complete to @samp{Foo}. 199@samp{insert-buffer} is not a valid completion for @samp{IN}.
205Completion ignores case distinctions for certain arguments in which 200Completion ignores case distinctions for certain arguments in which
206case does not matter. 201case does not matter.
207 202
208 Completion acts only on the text before point. If there is text in
209the minibuffer after point---i.e., if you move point backward after
210typing some text into the minibuffer---it remains unchanged.
211
212@menu 203@menu
213* Example: Completion Example. Examples of using completion. 204* Example: Completion Example. Examples of using completion.
214* Commands: Completion Commands. A list of completion commands. 205* Commands: Completion Commands. A list of completion commands.
@@ -220,22 +211,24 @@ typing some text into the minibuffer---it remains unchanged.
220@subsection Completion Example 211@subsection Completion Example
221 212
222@kindex TAB @r{(completion)} 213@kindex TAB @r{(completion)}
223 A concrete example may help here. If you type @kbd{M-x au 214 A concrete example may help here. If you type @kbd{M-x a u
224@key{TAB}}, the @key{TAB} looks for alternatives (in this case, 215@key{TAB}}, the @key{TAB} looks for alternatives (in this case,
225command names) that start with @samp{au}. There are several, 216command names) that start with @samp{au}. There are several,
226including @code{auto-fill-mode} and @code{auto-save-mode}, but they 217including @code{auto-fill-mode} and @code{autoconf-mode}, but they all
227all begin with @code{auto-}, so the @samp{au} in the minibuffer 218begin with @code{auto}, so the @samp{au} in the minibuffer completes
228completes to @samp{auto-}. 219to @samp{auto}.
229 220
230 If you type @key{TAB} again immediately, it cannot determine the 221 If you type @key{TAB} again immediately, it cannot determine the
231next character; it could be any of @samp{cfilrs}. So it does not add 222next character; it could be @samp{-}, @samp{a}, or @samp{c}. So it
232any characters; instead, @key{TAB} displays a list of all possible 223does not add any characters; instead, @key{TAB} displays a list of all
233completions in another window. 224possible completions in another window.
234 225
235 Now type @kbd{f @key{TAB}}. This @key{TAB} sees @samp{auto-f}. The 226 Next, type @kbd{- f}. The minibuffer now contains @samp{auto-f},
236only command name starting with that is @code{auto-fill-mode}, so 227and the only command name that starts with this is
237completion fills in the rest of that. You have been able to enter 228@code{auto-fill-mode}. If you now type @key{TAB}, completion fills in
238@samp{auto-fill-mode} by typing just @kbd{au @key{TAB} f @key{TAB}}. 229the rest of the argument @samp{auto-fill-mode} into the minibuffer.
230You have been able to enter @samp{auto-fill-mode} by typing just
231@kbd{a u @key{TAB} - f @key{TAB}}.
239 232
240@node Completion Commands 233@node Completion Commands
241@subsection Completion Commands 234@subsection Completion Commands
@@ -246,7 +239,8 @@ when completion is allowed.
246@table @kbd 239@table @kbd
247@item @key{TAB} 240@item @key{TAB}
248@findex minibuffer-complete 241@findex minibuffer-complete
249Complete the text before point in the minibuffer as much as possible 242Complete the text before point in the minibuffer as much as possible;
243if unable to complete, display a list of possible completions
250(@code{minibuffer-complete}). 244(@code{minibuffer-complete}).
251@item @key{SPC} 245@item @key{SPC}
252Complete up to one word from the minibuffer text before point 246Complete up to one word from the minibuffer text before point
@@ -255,13 +249,12 @@ available when entering a file name, since file names often include
255spaces. 249spaces.
256@item @key{RET} 250@item @key{RET}
257Submit the text in the minibuffer as the argument, possibly completing 251Submit the text in the minibuffer as the argument, possibly completing
258first as described 252first as described in the next
259@iftex 253@iftex
260in the next subsection (@code{minibuffer-complete-and-exit}). 254subsection (@code{minibuffer-complete-and-exit}).
261@end iftex 255@end iftex
262@ifnottex 256@ifnottex
263in the next node (@code{minibuffer-complete-and-exit}). @xref{Strict 257node (@code{minibuffer-complete-and-exit}). @xref{Strict Completion}.
264Completion}.
265@end ifnottex 258@end ifnottex
266@item ? 259@item ?
267Display a list of possible completions of the text before point 260Display a list of possible completions of the text before point
@@ -270,13 +263,12 @@ Display a list of possible completions of the text before point
270 263
271@kindex SPC 264@kindex SPC
272@findex minibuffer-complete-word 265@findex minibuffer-complete-word
273 @key{SPC} completes like @key{TAB}, but only up to the next hyphen 266 @key{SPC} (@code{minibuffer-complete-word}) completes like
274or space. If you have @samp{auto-f} in the minibuffer and type 267@key{TAB}, but only up to the next hyphen or space. If you have
275@key{SPC}, it finds that the completion is @samp{auto-fill-mode}, but 268@samp{auto-f} in the minibuffer and type @key{SPC}, it finds that the
276it only inserts @samp{ill-}, giving @samp{auto-fill-}. Another 269completion is @samp{auto-fill-mode}, but it only inserts @samp{ill-},
277@key{SPC} at this point completes all the way to 270giving @samp{auto-fill-}. Another @key{SPC} at this point completes
278@samp{auto-fill-mode}. The command that implements this behavior is 271all the way to @samp{auto-fill-mode}.
279called @code{minibuffer-complete-word}.
280 272
281 When you display a list of possible completions, you can choose 273 When you display a list of possible completions, you can choose
282one from it: 274one from it:
@@ -286,34 +278,34 @@ one from it:
286@item Mouse-1 278@item Mouse-1
287@itemx Mouse-2 279@itemx Mouse-2
288Clicking mouse button 1 or 2 on a completion possibility chooses that 280Clicking mouse button 1 or 2 on a completion possibility chooses that
289completion (@code{mouse-choose-completion}). You must click in the 281completion (@code{mouse-choose-completion}).
290list of completions, not in the minibuffer.
291 282
292@findex switch-to-completions 283@findex switch-to-completions
293@item @key{PRIOR} 284@item M-v
294@itemx M-v 285@itemx @key{PageUp}
295Typing @key{PRIOR} or @key{PAGE-UP}, or @kbd{M-v}, while in the 286@itemx @key{PRIOR}
296minibuffer, selects the window showing the completion list buffer 287Typing @kbd{M-v}, while in the minibuffer, selects the window showing
297(@code{switch-to-completions}). This paves the way for using the 288the completion list buffer (@code{switch-to-completions}). This paves
298commands below. (Selecting that window in other ways has the same 289the way for using the commands below. Typing @key{PageUp} or
299effect.) 290@key{PRIOR} does the same, as does selecting that window in other
291ways.
300 292
301@findex choose-completion 293@findex choose-completion
302@item @key{RET} 294@item @key{RET}
303Typing @key{RET} @emph{in the completion list buffer} chooses the 295Typing @key{RET}, while in the completion list buffer, chooses the
304completion that point is in or next to (@code{choose-completion}). To 296completion that point is in or next to (@code{choose-completion}). To
305use this command, you must first switch to the completion list window. 297use this command, you must first switch to the completion list window.
306 298
307@findex next-completion 299@findex next-completion
308@item @key{RIGHT} 300@item @key{Right}
309Typing the right-arrow key @key{RIGHT} @emph{in the completion list 301Typing the right-arrow key @key{Right}, while in the completion list
310buffer} moves point to the following completion possibility 302buffer, moves point to the following completion possibility
311(@code{next-completion}). 303(@code{next-completion}).
312 304
313@findex previous-completion 305@findex previous-completion
314@item @key{LEFT} 306@item @key{Left}
315Typing the left-arrow key @key{LEFT} @emph{in the completion list 307Typing the left-arrow key @key{Left}, while in the completion list
316buffer} moves point to the previous completion possibility 308buffer, moves point to the previous completion possibility
317(@code{previous-completion}). 309(@code{previous-completion}).
318@end table 310@end table
319 311
@@ -357,29 +349,34 @@ the list with @kbd{C-M-v} (@pxref{Other Window}).
357@node Completion Options 349@node Completion Options
358@subsection Completion Options 350@subsection Completion Options
359 351
352@vindex completion-auto-help
353 If @code{completion-auto-help} is set to @code{nil}, the completion
354commands never display the completion list buffer; you must type
355@kbd{?} to display the list. If the value is @code{lazy}, Emacs only
356shows the completion list buffer on the second attempt to complete.
357In other words, if there is nothing to complete, the first @key{TAB}
358echoes @samp{Next char not unique}; the second @key{TAB} does the
359completion list buffer buffer.
360
360@vindex completion-ignored-extensions 361@vindex completion-ignored-extensions
361@cindex ignored file names, in completion 362@cindex ignored file names, in completion
362 When completing file names, certain file names are usually ignored. 363 When completing file names, certain file names are usually ignored.
363The variable @code{completion-ignored-extensions} contains a list of 364The variable @code{completion-ignored-extensions} contains a list of
364strings; a file name ending in any of those strings is ignored as a 365strings; a file name ending in any of those strings is ignored as a
365completion candidate. The standard value of this variable has several 366completion candidate. The standard value of this variable has several
366elements including @code{".o"}, @code{".elc"}, @code{".dvi"} and 367elements including @code{".o"}, @code{".elc"}, and @code{"~"}. For
367@code{"~"}. The effect is that, for example, @samp{foo} can complete 368example, if a directory contains @samp{foo.c} and @samp{foo.elc},
368to @samp{foo.c} even though @samp{foo.o} exists as well. However, if 369@samp{foo} completes to @samp{foo.c}. However, if @emph{all} possible
369@emph{all} the possible completions end in ``ignored'' strings, then 370completions end in ``ignored'' strings, they are not ignored: in the
370they are not ignored. Displaying a list of possible completions 371previous example, @samp{foo.e} completes to @samp{foo.elc}.
371disregards @code{completion-ignored-extensions}; it shows them all. 372Displaying a list of possible completions disregards
373@code{completion-ignored-extensions}; it shows them all.
372 374
373 If an element of @code{completion-ignored-extensions} ends in a 375 If an element of @code{completion-ignored-extensions} ends in a
374slash (@file{/}), it's a subdirectory name; then that directory and 376slash (@file{/}), it's a subdirectory name; that directory and its
375its contents are ignored. Elements of 377contents are ignored. Elements of
376@code{completion-ignored-extensions} which do not end in a slash are 378@code{completion-ignored-extensions} that do not end in a slash are
377ordinary file names, and do not apply to names of directories. 379ordinary file names.
378
379@vindex completion-auto-help
380 If @code{completion-auto-help} is set to @code{nil}, the completion
381commands never display a list of possibilities; you must type @kbd{?}
382to display the list.
383 380
384@cindex Partial Completion mode 381@cindex Partial Completion mode
385@vindex partial-completion-mode 382@vindex partial-completion-mode
@@ -390,7 +387,7 @@ it can complete the command name abbreviation @code{p-b} into
390@code{print-buffer} if no other command starts with two words whose 387@code{print-buffer} if no other command starts with two words whose
391initials are @samp{p} and @samp{b}. 388initials are @samp{p} and @samp{b}.
392 389
393 To enable this mode, use @kbd{M-x partial-completion-mode}, or 390 To enable this mode, use @kbd{M-x partial-completion-mode} or
394customize the variable @code{partial-completion-mode}. This mode 391customize the variable @code{partial-completion-mode}. This mode
395binds special partial completion commands to @key{TAB}, @key{SPC}, 392binds special partial completion commands to @key{TAB}, @key{SPC},
396@key{RET}, and @kbd{?} in the minibuffer. The usual completion 393@key{RET}, and @kbd{?} in the minibuffer. The usual completion
@@ -423,19 +420,18 @@ icomplete-mode}.
423@cindex minibuffer history 420@cindex minibuffer history
424@cindex history of minibuffer input 421@cindex history of minibuffer input
425 422
426 Every argument that you enter with the minibuffer is saved on a 423 Every argument that you enter with the minibuffer is saved in a
427@dfn{minibuffer history list} so you can easily use it again later. 424@dfn{minibuffer history list} so you can easily use it again later.
428Special commands fetch the text of an earlier argument into the 425You can use the following arguments to quickly fetch an earlier
429minibuffer, replacing the old minibuffer contents. You can think of 426argument into the minibuffer:
430them as moving through the history of previous arguments.
431 427
432@table @kbd 428@table @kbd
433@item @key{UP} 429@item M-p
434@itemx M-p 430@itemx @key{Up}
435Move to the previous item in the minibuffer history, an earlier argument 431Move to the previous item in the minibuffer history, an earlier
436(@code{previous-history-element}). 432argument (@code{previous-history-element}).
437@item @key{DOWN} 433@item M-n
438@itemx M-n 434@itemx @key{Down}
439Move to the next item in the minibuffer history 435Move to the next item in the minibuffer history
440(@code{next-history-element}). 436(@code{next-history-element}).
441@item M-r @var{regexp} @key{RET} 437@item M-r @var{regexp} @key{RET}
@@ -450,24 +446,27 @@ Move to a later item in the minibuffer history that matches
450@kindex M-n @r{(minibuffer history)} 446@kindex M-n @r{(minibuffer history)}
451@findex next-history-element 447@findex next-history-element
452@findex previous-history-element 448@findex previous-history-element
453 To move through the minibuffer history list one item at a time, use 449 While in the minibuffer, typing @kbd{M-p} or @key{Up}
454@kbd{M-p} or up-arrow (@code{previous-history-element}) to fetch the 450(@code{previous-history-element}) moves up through the minibuffer
455next earlier minibuffer input, and use @kbd{M-n} or down-arrow 451history list, one item at a time. Each @kbd{M-p} fetches an earlier
456(@code{next-history-element}) to fetch the next later input. These 452item from the history list into the minibuffer, replacing its existing
457commands don't move the cursor, they pull different saved strings into 453contents. Similarly, typing @kbd{M-n} or @key{Down}
458the minibuffer. But you can think of them as ``moving'' through the 454(@code{next-history-element}) moves back down the history list,
459history list. 455fetching later entries into the minibuffer. You can think of these
460 456commands as ``backwards'' and ``forwards'' through the history list.
461 The input that you fetch from the history entirely replaces the 457
462contents of the minibuffer. To use it again unchanged, just type 458 If you type @kbd{M-n} in the minibuffer when there are no later
463@key{RET}. You can also edit the text before you reuse it; this does 459entries in the minibuffer history (e.g., if you haven't previously
464not change the history element that you ``moved'' to, but your new 460typed @kbd{M-p}), Emacs tries fetching from a list of default
465argument does go at the end of the history list in its own right. 461argument: values that you are likely to enter. You can think of this
466 462as moving through the ``future list'' instead of the ``history list''.
467 For many minibuffer arguments there is a ``default'' value, or 463
468a list of default values. You can insert the default value into the 464 The input that @kbd{M-p} or @kbd{M-n} fetches into the minibuffer
469minibuffer as text by using @kbd{M-n} one or more times. You can 465entirely replaces the existing contents of the minibuffer, so you can
470think of this as moving ``into the future'' in the history. 466simply type @key{RET} to use it as an argument. You can also edit the
467text before you reuse it; this does not change the history element
468that you ``moved'' to, but your new argument does go at the end of the
469history list in its own right.
471 470
472@findex previous-matching-history-element 471@findex previous-matching-history-element
473@findex next-matching-history-element 472@findex next-matching-history-element
@@ -478,21 +477,11 @@ history; they search for history elements that match a regular
478expression. @kbd{M-r} (@code{previous-matching-history-element}) 477expression. @kbd{M-r} (@code{previous-matching-history-element})
479searches older elements in the history, while @kbd{M-s} 478searches older elements in the history, while @kbd{M-s}
480(@code{next-matching-history-element}) searches newer elements. These 479(@code{next-matching-history-element}) searches newer elements. These
481commands are unusual; they use the minibuffer to read the regular 480commands are unusual: they use the minibuffer to read the regular
482expression even though they are invoked from the minibuffer. As with 481expression even though they are invoked from the minibuffer. As with
483incremental searching, an upper-case letter in the regular expression 482incremental searching, an upper-case letter in the regular expression
484makes the search case-sensitive (@pxref{Search Case}). 483makes the search case-sensitive (@pxref{Search Case}).
485 484
486@ignore
487 We may change the precise way these commands read their arguments.
488Perhaps they will search for a match for the string given so far in the
489minibuffer; perhaps they will search for a literal match rather than a
490regular expression match; perhaps they will only accept matches at the
491beginning of a history element; perhaps they will read the string to
492search for incrementally like @kbd{C-s}. To find out what interface is
493actually available, type @kbd{C-h f previous-matching-history-element}.
494@end ignore
495
496 All uses of the minibuffer record your input on a history list, but 485 All uses of the minibuffer record your input on a history list, but
497there are separate history lists for different kinds of arguments. 486there are separate history lists for different kinds of arguments.
498For example, there is a list for file names, used by all the commands 487For example, there is a list for file names, used by all the commands
@@ -510,12 +499,13 @@ one used by @kbd{M-x} for command names, and one used by
510 The variable @code{history-length} specifies the maximum length of a 499 The variable @code{history-length} specifies the maximum length of a
511minibuffer history list; adding a new element deletes the oldest 500minibuffer history list; adding a new element deletes the oldest
512element if the list gets too long. If the value of 501element if the list gets too long. If the value of
513@code{history-length} is @code{t}, though, there is no maximum length. 502@code{history-length} is @code{t}, there is no maximum length.
514 503
515@vindex history-delete-duplicates 504@vindex history-delete-duplicates
516 The variable @code{history-delete-duplicates} specifies whether to 505 The variable @code{history-delete-duplicates} specifies whether to
517delete duplicates in history. If it is @code{t}, adding a new element 506delete duplicates in history. If it is non-@code{nil}, adding a new
518deletes from the list all other elements that are equal to it. 507element deletes from the list all other elements that are equal to it.
508The default is @code{nil}.
519 509
520@node Repetition 510@node Repetition
521@section Repeating Minibuffer Commands 511@section Repeating Minibuffer Commands