aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2006-06-04 02:17:49 +0000
committerRichard M. Stallman2006-06-04 02:17:49 +0000
commit3c8c279cc1bbf28fdac7db14dc9e100d576a86cd (patch)
tree2e25524ed0c8bc5d4d3e1fa012a3cfa8f120c509
parente38cc268e2d391191b6a81b9b72f4cd1491faafa (diff)
downloademacs-3c8c279cc1bbf28fdac7db14dc9e100d576a86cd.tar.gz
emacs-3c8c279cc1bbf28fdac7db14dc9e100d576a86cd.zip
Lots of cleanups.
-rw-r--r--man/ChangeLog4
-rw-r--r--man/mini.texi608
2 files changed, 292 insertions, 320 deletions
diff --git a/man/ChangeLog b/man/ChangeLog
index e4280d404d8..85c89fbe4d5 100644
--- a/man/ChangeLog
+++ b/man/ChangeLog
@@ -1,3 +1,7 @@
12006-06-03 Ted Zlatanov <tzz@lifelogs.com>
2
3 * mini.texi: Lots of cleanups.
4
12006-06-01 Luc Teirlinck <teirllm@auburn.edu> 52006-06-01 Luc Teirlinck <teirllm@auburn.edu>
2 6
3 * misc.texi (Shell History Copying): Update descriptions of `C-c RET' 7 * misc.texi (Shell History Copying): Update descriptions of `C-c RET'
diff --git a/man/mini.texi b/man/mini.texi
index 4c3748a78f1..e0a851cfc9a 100644
--- a/man/mini.texi
+++ b/man/mini.texi
@@ -6,55 +6,53 @@
6@chapter The Minibuffer 6@chapter The Minibuffer
7@cindex minibuffer 7@cindex minibuffer
8 8
9 The @dfn{minibuffer} is the facility used by Emacs commands to read 9 The @dfn{minibuffer} is where Emacs commands read complicated
10arguments more complicated than a single number. Minibuffer arguments 10arguments (anything more a single number). We call it the
11can be file names, buffer names, Lisp function names, Emacs command 11``minibuffer'' because it's a special-purpose buffer with a small
12names, Lisp expressions, and many other things, depending on the command 12amount of screen space. Minibuffer arguments can be file names,
13reading the argument. You can use the usual Emacs editing commands in 13buffer names, Lisp function names, Emacs command names, Lisp
14the minibuffer to edit the argument text. 14expressions, and many other things---whatever the command wants to
15read. You can use the usual Emacs editing commands in the minibuffer
16to edit the argument text.
15 17
16@cindex prompt 18@cindex prompt
17 When the minibuffer is in use, it appears in the echo area, and the 19 When the minibuffer is in use, it appears in the echo area, with a
18terminal's cursor moves there. The beginning of the minibuffer line 20cursor. The minibuffer display starts with a @dfn{prompt} in a
19displays a @dfn{prompt} in a special color, to say what kind of input 21distinct color; it says what kind of input is expected and how it will
20you should supply and how it will be used. Often this prompt is 22be used. Often the prompt is derived from the name of the command
21derived from the name of the command that the argument is for. The 23that is reading the argument. The prompt normally ends with a colon.
22prompt normally ends with a colon.
23 24
24@cindex default argument 25@cindex default argument
25 Sometimes a @dfn{default argument} appears in parentheses before the 26 Sometimes a @dfn{default argument} appears in the prompt, inside
26colon; it too is part of the prompt. The default will be used as the 27parentheses before the colon. The default will be used as the
27argument value if you enter an empty argument (that is, just type 28argument value if you just type @key{RET}. For example, commands that
28@key{RET}). For example, commands that read buffer names always show a 29read buffer names show a buffer name as the default. You can type
29default, which is the name of the buffer that will be used if you type 30@key{RET} to operate on that default buffer.
30just @key{RET}. 31
31 32 The simplest way to enter a minibuffer argument is to type the text,
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,
33you want, terminated by @key{RET} which exits the minibuffer. You can 34and the command that wants the argument, by typing @kbd{C-g}.
34cancel the command that wants the argument, and get out of the 35
35minibuffer, by typing @kbd{C-g}. 36 Since the minibuffer appears in the echo area, it can conflict with
36 37other uses of the echo area. Here is how Emacs handles such
37 Since the minibuffer uses the screen space of the echo area, it can 38conflicts:
38conflict with other ways Emacs customarily uses the echo area. Here is how
39Emacs handles such conflicts:
40 39
41@itemize @bullet 40@itemize @bullet
42@item 41@item
43If a command gets an error while you are in the minibuffer, this does 42An error occurs while the minibuffer is active.
44not cancel the minibuffer. However, the echo area is needed for the 43
45error message and therefore the minibuffer itself is hidden for a 44The error message hides the minibuffer for a few seconds, or until you
46while. It comes back after a few seconds, or as soon as you type 45type something. Then the minibuffer comes back.
47anything.
48 46
49@item 47@item
50If in the minibuffer you use a command whose purpose is to display a 48A command such as @kbd{C-x =} needs to display a message in the echo
51message in the echo area, such as @kbd{C-x =}, the message hides the 49area.
52minibuffer for a while. The minibuffer contents come back after a few 50
53seconds, or as soon as you type anything. 51The message hides the minibuffer for a few seconds, or until you type
52something. Then the minibuffer comes back.
54 53
55@item 54@item
56Echoing of keystrokes does not take place while the minibuffer is in 55Keystrokes don't echo while the minibuffer is in use.
57use.
58@end itemize 56@end itemize
59 57
60@menu 58@menu
@@ -68,34 +66,32 @@ use.
68@node Minibuffer File 66@node Minibuffer File
69@section Minibuffers for File Names 67@section Minibuffers for File Names
70 68
71 Sometimes the minibuffer starts out with text in it. For example, when 69 When you use the minibuffer to enter a file name, it starts out with
72you are supposed to give a file name, the minibuffer starts out containing 70some initial text---the @dfn{default directory}, ending in a slash.
73the @dfn{default directory}, which ends with a slash. This is to inform 71The file you specify will be in this directory unless you alter or
74you which directory the file will be found in if you do not specify a 72replace it.
75directory.
76 73
77@c Separate paragraph to clean up ugly page break--rms 74@c Separate paragraph to clean up ugly page break--rms
78@need 1500 75@need 1500
79 For example, the minibuffer might start out with these contents: 76 For example, if the minibuffer starts out with these contents:
80 77
81@example 78@example
82Find File: /u2/emacs/src/ 79Find File: /u2/emacs/src/
83@end example 80@end example
84 81
85@noindent 82@noindent
86where @samp{Find File:@: } is the prompt. Typing @kbd{buffer.c} as 83(where @samp{Find File:@: } is the prompt), and you type
87input specifies the file @file{/u2/emacs/src/buffer.c}. To find files 84@kbd{buffer.c} as input, that specifies the file
88in nearby directories, use @kbd{..}; thus, if you type 85@file{/u2/emacs/src/buffer.c}. You can specify the parent directory
89@kbd{../lisp/simple.el}, you will get the file named 86by adding @file{..}; thus, if you type @kbd{../lisp/simple.el}, you
90@file{/u2/emacs/lisp/simple.el}. Alternatively, you can kill with 87will get @file{/u2/emacs/lisp/simple.el}. Alternatively, you can use
91@kbd{M-@key{DEL}} the directory names you don't want (@pxref{Words}). 88@kbd{M-@key{DEL}} to kill the directory names you don't want
92 89(@pxref{Words}).
93 If you don't want any of the default, you can kill it with @kbd{C-a 90
94C-k}. But you don't need to kill the default; you can simply ignore it. 91 You can kill it the entire default with @kbd{C-a C-k}, but there's
95Insert an absolute file name, one starting with a slash or a tilde, 92no need. You can simply ignore it and give an absolute file name
96after the default directory. For example, to specify the file 93starting with a slash or a tilde after the default directory. For
97@file{/etc/termcap}, just insert that name, giving these minibuffer 94example, to specify @file{/etc/termcap}, just type that name:
98contents:
99 95
100@example 96@example
101Find File: /u2/emacs/src//etc/termcap 97Find File: /u2/emacs/src//etc/termcap
@@ -106,59 +102,55 @@ Find File: /u2/emacs/src//etc/termcap
106@cindex double slash in file name 102@cindex double slash in file name
107@cindex slashes repeated in file name 103@cindex slashes repeated in file name
108@findex file-name-shadow-mode 104@findex file-name-shadow-mode
109GNU Emacs gives a special meaning to a double slash (which is not 105GNU Emacs interprets a double slash (which is not normally useful in
110normally a useful thing to write): it means, ``ignore everything 106file names) as, ``ignore everything before the second slash in the
111before the second slash in the pair.'' Thus, @samp{/u2/emacs/src/} is 107pair.'' In the example above. @samp{/u2/emacs/src/} is ignored, so
112ignored in the example above, and you get the file 108you get @file{/etc/termcap}. The ignored part of the file name is
113@file{/etc/termcap}. The ignored part of the file name is dimmed if 109dimmed if the terminal allows it; to disable this dimming, turn off
114the terminal allows it; to disable this, turn off 110File Name Shadow mode (a minor mode) with the command
115@code{file-name-shadow-mode} minor mode. 111@kbd{M-x file-name-shadow-mode}.
116 112
117 If you set @code{insert-default-directory} to @code{nil}, the 113 If the variable @code{insert-default-directory} is @code{nil}, the
118default directory is never inserted in the minibuffer---so the 114default directory is never inserted in the minibuffer---so the
119minibuffer starts out empty. But the name you type, if relative, is 115minibuffer starts out empty. Nonetheless, relative file name
120still interpreted with respect to the same default directory. 116arguments are still interpreted based on the same default directory.
121 117
122@node Minibuffer Edit 118@node Minibuffer Edit
123@section Editing in the Minibuffer 119@section Editing in the Minibuffer
124 120
125 The minibuffer is an Emacs buffer (albeit a peculiar one), and the usual 121 The minibuffer is an Emacs buffer (albeit a peculiar one), and the
126Emacs commands are available for editing the text of an argument you are 122usual Emacs commands are available for editing the argument text.
127entering.
128 123
129 Since @key{RET} in the minibuffer is defined to exit the minibuffer, 124 Since @key{RET} in the minibuffer is defined to exit the minibuffer,
130you can't use it to insert a newline in the minibuffer. To do that, 125you can't use it to insert a newline in the minibuffer. To do that,
131type @kbd{C-o} or @kbd{C-q C-j}. (The newline character is really the 126type @kbd{C-o} or @kbd{C-q C-j}. (The newline character is really the
132@acronym{ASCII} character control-J.) 127@acronym{ASCII} character control-J.)
133 128
134 The minibuffer has its own window, which normally has space on the 129 The minibuffer has its own window, which normally has space in the
135Emacs frame at all times, but it only acts like an Emacs window when 130frame at all times, but it only acts like an Emacs window when the
136the minibuffer is really in use. At those times, its window is much 131minibuffer is active. When active, this window is much like any other
137like any other Emacs window; you can switch from the minibuffer window 132Emacs window; for instance, you can switch to another window (with
138to another window with @kbd{C-x o}, and edit text in other windows, 133@kbd{C-x o}), edit text there, then return to the minibuffer window to
139before returning to the minibuffer to submit the argument. You can 134finish the argument. You can even kill text in another window, return
140kill text in another window, return to the minibuffer window, and then 135to the minibuffer window, and then yank the text into the argument.
141yank the text to use it in the argument. @xref{Windows}. 136@xref{Windows}.
142 137
143@cindex height of minibuffer 138@cindex height of minibuffer
144@cindex size of minibuffer 139@cindex size of minibuffer
145@cindex growing minibuffer 140@cindex growing minibuffer
146@cindex resizing minibuffer 141@cindex resizing minibuffer
147 There are some restrictions on the use of the minibuffer window, 142 There are some restrictions on the minibuffer window, however: you
148however. You cannot switch buffers in it---the minibuffer and its 143cannot kill it, or split it, or switch buffers in it---the minibuffer
149window are permanently attached. Also, you cannot split or kill the 144and its window are permanently attached.
150minibuffer window. But you can make it taller in the normal fashion
151with @kbd{C-x ^}.
152 145
153@vindex resize-mini-windows 146@vindex resize-mini-windows
154 The minibuffer window expands vertically as necessary to hold the 147 The minibuffer window expands vertically as necessary to hold the
155text that you put in the minibuffer. If @code{resize-mini-windows} is 148text that you put in the minibuffer. If @code{resize-mini-windows} is
156@code{t} (the default), the window is always resized to fit the size 149@code{t} (the default), the window always resizes as needed by its
157of the text it displays. If its value is the symbol @code{grow-only}, 150contents. If its value is the symbol @code{grow-only}, the window
158the window grows when the size of displayed text increases, but 151grows automatically as needed, but shrinks (back to the normal size)
159shrinks (back to the normal size) only when the minibuffer becomes 152only when the minibuffer becomes inactive. If its value is
160inactive. If its value is @code{nil}, you have to adjust the height 153@code{nil}, you have to adjust the height yourself.
161yourself.
162 154
163@vindex max-mini-window-height 155@vindex max-mini-window-height
164 The variable @code{max-mini-window-height} controls the maximum 156 The variable @code{max-mini-window-height} controls the maximum
@@ -167,52 +159,47 @@ specifies a fraction of the frame's height; an integer specifies the
167maximum number of lines; @code{nil} means do not resize the minibuffer 159maximum number of lines; @code{nil} means do not resize the minibuffer
168window automatically. The default value is 0.25. 160window automatically. The default value is 0.25.
169 161
170 If, while in the minibuffer, you issue a command that displays help 162 The @kbd{C-M-v} command in the minibuffer scrolls the help text from
171text of any sort in another window, you can use the @kbd{C-M-v} 163commands that display help text of any sort in another window.
172command while in the minibuffer to scroll the help text. 164@kbd{M-@key{PAGEUP}} and @kbd{M-@key{PAGEDOWN}} also operate on that
173(@kbd{M-@key{PAGEUP}} and @kbd{M-@key{PAGEDOWN}} also operate on that 165help text. This is especially useful with long lists of possible
174help text.) This lasts until you exit the minibuffer. This feature
175is especially useful when you display a buffer listing possible
176completions. @xref{Other Window}. 166completions. @xref{Other Window}.
177 167
178@vindex enable-recursive-minibuffers 168@vindex enable-recursive-minibuffers
179 Emacs normally disallows most commands that use the minibuffer while 169 Emacs normally disallows most commands that use the minibuffer while
180the minibuffer is active. This rule is to prevent recursive minibuffers 170the minibuffer is active. (Entering the minibuffer from the
181from confusing novice users. If you want to be able to use such 171minibuffer can be confusing.) To allow such commands in the
182commands in the minibuffer, set the variable 172minibuffer, set the variable @code{enable-recursive-minibuffers} to
183@code{enable-recursive-minibuffers} to a non-@code{nil} value. 173@code{t}.
184 174
185@node Completion 175@node Completion
186@section Completion 176@section Completion
187@cindex completion 177@cindex completion
188 178
189 For certain kinds of arguments, you can use @dfn{completion} to enter 179 Some arguments allow @dfn{completion} to enter their value. This
190the argument value. Completion means that you type part of the 180means that after you type part of the argument, Emacs can fill in the
191argument, then Emacs visibly fills in the rest, or as much as 181rest, or some of it, based on what you have typed so far.
192can be determined from the part you have typed. 182
193 183 When completion is available, certain keys---@key{TAB}, @key{RET},
194 When completion is available, certain keys---@key{TAB}, @key{RET}, and 184and @key{SPC}---are rebound to complete the text in the minibuffer
195@key{SPC}---are rebound to complete the text in the minibuffer before point 185before point into a longer string chosen from a set of @dfn{completion
196into a longer string that it stands for, by matching it against a set of 186alternatives} provided by the command that requested the argument.
197@dfn{completion alternatives} provided by the command reading the 187(@key{SPC} does not do completion in reading file names, because it is
198argument. @kbd{?} is defined to display a list of possible completions 188common to use spaces in file names on some systems.) @kbd{?} displays
199of what you have inserted. 189a list of the possible completions at any time.
200 190
201 For example, when @kbd{M-x} uses the minibuffer to read the name of 191 For example, @kbd{M-x} uses the minibuffer to read the name of a
202a command, it provides a list of all available Emacs command names to 192command, so it provides a list of all Emacs command names for
203complete against. The completion keys match the minibuffer text 193completion candidates. The completion keys match the minibuffer text
204against all the command names, find any additional name characters 194against these candidates, find any additional name characters implied
205implied by the ones already present in the minibuffer, and add those 195by the the text already present in the minibuffer, and add those
206characters to the ones you have given. This is what makes it possible 196characters. This makes it possible to type @kbd{M-x ins @key{SPC} b
207to type @kbd{M-x ins @key{SPC} b @key{RET}} instead of @kbd{M-x 197@key{RET}} instead of @kbd{M-x insert-buffer @key{RET}}, for example.
208insert-buffer @key{RET}} (for example). (@key{SPC} does not do 198
209completion in reading file names, because it is common to use spaces 199 Case is significant in completion when it is significant in the
210in file names on some systems.) 200argument you are entering (buffer names, file names, command names,
211 201for instance). Thus, @samp{fo} does not complete to @samp{Foo}.
212 Case is normally significant in completion, because it is significant 202Completion ignores case distinctions for certain arguments in which
213in most of the names that you can complete (buffer names, file names and
214command names). Thus, @samp{fo} does not complete to @samp{Foo}.
215Completion does ignore case distinctions for certain arguments in which
216case does not matter. 203case does not matter.
217 204
218 Completion acts only on the text before point. If there is text in 205 Completion acts only on the text before point. If there is text in
@@ -230,42 +217,39 @@ typing some text into the minibuffer---it remains unchanged.
230@subsection Completion Example 217@subsection Completion Example
231 218
232@kindex TAB @r{(completion)} 219@kindex TAB @r{(completion)}
233@findex minibuffer-complete 220 A concrete example may help here. If you type @kbd{M-x au
234 A concrete example may help here. If you type @kbd{M-x au @key{TAB}}, 221@key{TAB}}, the @key{TAB} looks for alternatives (in this case,
235the @key{TAB} looks for alternatives (in this case, command names) that 222command names) that start with @samp{au}. There are several,
236start with @samp{au}. There are several, including 223including @code{auto-fill-mode} and @code{auto-save-mode}, but they
237@code{auto-fill-mode} and @code{auto-save-mode}---but they are all the 224all begin with @code{auto-}, so the @samp{au} in the minibuffer
238same as far as @code{auto-}, so the @samp{au} in the minibuffer changes 225completes to @samp{auto-}.
239to @samp{auto-}.@refill 226
240 227 If you type @key{TAB} again immediately, it cannot determine the
241 If you type @key{TAB} again immediately, there are multiple 228next character; it could be any of @samp{cfilrs}. So it does not add
242possibilities for the very next character---it could be any of 229any characters; instead, @key{TAB} displays a list of all possible
243@samp{cfilrs}---so no more characters are added; instead, @key{TAB} 230completions in another window.
244displays a list of all possible completions in another window. 231
245 232 Now type @kbd{f @key{TAB}}. This @key{TAB} sees @samp{auto-f}. The
246 If you go on to type @kbd{f @key{TAB}}, this @key{TAB} sees 233only command name starting with that is @code{auto-fill-mode}, so
247@samp{auto-f}. The only command name starting this way is 234completion fills in the rest of that. You have been able to enter
248@code{auto-fill-mode}, so completion fills in the rest of that. You now 235@samp{auto-fill-mode} by typing just @kbd{au @key{TAB} f @key{TAB}}.
249have @samp{auto-fill-mode} in the minibuffer after typing just @kbd{au
250@key{TAB} f @key{TAB}}. Note that @key{TAB} has this effect because in
251the minibuffer it is bound to the command @code{minibuffer-complete}
252when completion is available.
253 236
254@node Completion Commands 237@node Completion Commands
255@subsection Completion Commands 238@subsection Completion Commands
256 239
257 Here is a list of the completion commands defined in the minibuffer 240 Here is a list of the completion commands defined in the minibuffer
258when completion is available. 241when completion is allowed.
259 242
260@table @kbd 243@table @kbd
261@item @key{TAB} 244@item @key{TAB}
245@findex minibuffer-complete
262Complete the text before point in the minibuffer as much as possible 246Complete the text before point in the minibuffer as much as possible
263(@code{minibuffer-complete}). 247(@code{minibuffer-complete}).
264@item @key{SPC} 248@item @key{SPC}
265Complete the minibuffer text before point, but don't go beyond one 249Complete up to one word from the minibuffer text before point
266word (@code{minibuffer-complete-word}). @key{SPC} for completion is 250(@code{minibuffer-complete-word}). @key{SPC} for completion is not
267not available when entering a file name, since some users often put 251available when entering a file name, since file names often include
268spaces in filenames. 252spaces.
269@item @key{RET} 253@item @key{RET}
270Submit the text in the minibuffer as the argument, possibly completing 254Submit the text in the minibuffer as the argument, possibly completing
271first as described 255first as described
@@ -277,31 +261,30 @@ in the next node (@code{minibuffer-complete-and-exit}). @xref{Strict
277Completion}. 261Completion}.
278@end ifnottex 262@end ifnottex
279@item ? 263@item ?
280Display a list of all possible completions of the text in the minibuffer 264Display a list of possible completions of the text before point
281(@code{minibuffer-completion-help}). 265(@code{minibuffer-completion-help}).
282@end table 266@end table
283 267
284@kindex SPC 268@kindex SPC
285@findex minibuffer-complete-word 269@findex minibuffer-complete-word
286 @key{SPC} completes much like @key{TAB}, but never goes beyond the 270 @key{SPC} completes like @key{TAB}, but only up to the next hyphen
287next hyphen or space. If you have @samp{auto-f} in the minibuffer and 271or space. If you have @samp{auto-f} in the minibuffer and type
288type @key{SPC}, it finds that the completion is @samp{auto-fill-mode}, 272@key{SPC}, it finds that the completion is @samp{auto-fill-mode}, but
289but it stops completing after @samp{fill-}. This gives 273it only inserts @samp{ill-}, giving @samp{auto-fill-}. Another
290@samp{auto-fill-}. Another @key{SPC} at this point completes all the 274@key{SPC} at this point completes all the way to
291way to @samp{auto-fill-mode}. The command that implements this 275@samp{auto-fill-mode}. The command that implements this behavior is
292behavior is called @code{minibuffer-complete-word}. 276called @code{minibuffer-complete-word}.
293 277
294 Here are some commands you can use to choose a completion from a 278 When you display a list of possible completions, you can choose
295window that displays a list of completions: 279one from it:
296 280
297@table @kbd 281@table @kbd
298@findex mouse-choose-completion 282@findex mouse-choose-completion
299@item Mouse-1 283@item Mouse-1
300@itemx Mouse-2 284@itemx Mouse-2
301Clicking mouse button 1 or 2 on a completion in the list of possible 285Clicking mouse button 1 or 2 on a completion possibility chooses that
302completions chooses that completion (@code{mouse-choose-completion}). 286completion (@code{mouse-choose-completion}). You must click in the
303You normally use this command while point is in the minibuffer, but you 287list of completions, not in the minibuffer.
304must click in the list of completions, not in the minibuffer itself.
305 288
306@findex switch-to-completions 289@findex switch-to-completions
307@item @key{PRIOR} 290@item @key{PRIOR}
@@ -309,98 +292,91 @@ must click in the list of completions, not in the minibuffer itself.
309Typing @key{PRIOR} or @key{PAGE-UP}, or @kbd{M-v}, while in the 292Typing @key{PRIOR} or @key{PAGE-UP}, or @kbd{M-v}, while in the
310minibuffer, selects the window showing the completion list buffer 293minibuffer, selects the window showing the completion list buffer
311(@code{switch-to-completions}). This paves the way for using the 294(@code{switch-to-completions}). This paves the way for using the
312commands below. (Selecting that window in the usual ways has the same 295commands below. (Selecting that window in other ways has the same
313effect, but this way is more convenient.) 296effect.)
314 297
315@findex choose-completion 298@findex choose-completion
316@item @key{RET} 299@item @key{RET}
317Typing @key{RET} @emph{in the completion list buffer} chooses the 300Typing @key{RET} @emph{in the completion list buffer} chooses the
318completion that point is in or next to (@code{choose-completion}). To 301completion that point is in or next to (@code{choose-completion}). To
319use this command, you must first switch windows to the window that shows 302use this command, you must first switch to the completion list window.
320the list of completions.
321 303
322@findex next-completion 304@findex next-completion
323@item @key{RIGHT} 305@item @key{RIGHT}
324Typing the right-arrow key @key{RIGHT} @emph{in the completion list 306Typing the right-arrow key @key{RIGHT} @emph{in the completion list
325buffer} moves point to the following completion (@code{next-completion}). 307buffer} moves point to the following completion possibility
308(@code{next-completion}).
326 309
327@findex previous-completion 310@findex previous-completion
328@item @key{LEFT} 311@item @key{LEFT}
329Typing the left-arrow key @key{LEFT} @emph{in the completion list 312Typing the left-arrow key @key{LEFT} @emph{in the completion list
330buffer} moves point toward the beginning of the buffer, to the previous 313buffer} moves point to the previous completion possibility
331completion (@code{previous-completion}). 314(@code{previous-completion}).
332@end table 315@end table
333 316
334@node Strict Completion 317@node Strict Completion
335@subsection Strict Completion 318@subsection Strict Completion
336 319
337 There are three different ways that @key{RET} can work in completing 320 There are three different ways that @key{RET} can do completion,
338minibuffers, depending on how the argument will be used. 321depending on how the argument will be used.
339 322
340@itemize @bullet 323@itemize @bullet
341@item 324@item
342@dfn{Strict} completion is used when it is meaningless to give any 325@dfn{Strict} completion accepts only known completion candidates. For
343argument except one of the known alternatives. For example, when 326example, when @kbd{C-x k} reads the name of a buffer to kill, only the
344@kbd{C-x k} reads the name of a buffer to kill, it is meaningless to 327name of an existing buffer makes sense. In strict completion,
345give anything but the name of an existing buffer. In strict 328@key{RET} refuses to exit if the text in the minibuffer does not
346completion, @key{RET} refuses to exit if the text in the minibuffer 329complete to an exact match.
347does not complete to an exact match.
348 330
349@item 331@item
350@dfn{Cautious} completion is similar to strict completion, except that 332@dfn{Cautious} completion is similar to strict completion, except that
351@key{RET} exits only if the text was an exact match already, not 333@key{RET} exits only if the text is an already exact match.
352needing completion. If the text is not an exact match, @key{RET} does 334Otherwise, @key{RET} does not exit, but it does complete the text. If
353not exit, but it does complete the text. If it completes to an exact 335that completes to an exact match, a second @key{RET} will exit.
354match, a second @key{RET} will exit.
355 336
356Cautious completion is used for reading file names for files that must 337Cautious completion is used for reading file names for files that must
357already exist. 338already exist, for example.
358 339
359@item 340@item
360@dfn{Permissive} completion is used when any string whatever is 341@dfn{Permissive} completion allows any input; the completion
361meaningful, and the list of completion alternatives is just a guide. 342candidates are just suggestions. For example, when @kbd{C-x C-f}
362For example, when @kbd{C-x C-f} reads the name of a file to visit, any 343reads the name of a file to visit, any file name is allowed, including
363file name is allowed, in case you want to create a file. In 344nonexistent file (in case you want to create a file). In permissive
364permissive completion, @key{RET} takes the text in the minibuffer 345completion, @key{RET} does not complete, it just submits the argument
365exactly as given, without completing it. 346as you have entered it.
366@end itemize 347@end itemize
367 348
368 The completion commands display a list of all possible completions in 349 The completion commands display a list of all possible completions
369a window whenever there is more than one possibility for the very next 350whenever they can't determine even one more character by completion.
370character. Also, typing @kbd{?} explicitly requests such a list. If 351Also, typing @kbd{?} explicitly requests such a list. You can scroll
371the list of completions is long, you can scroll it with @kbd{C-M-v} 352the list with @kbd{C-M-v} (@pxref{Other Window}).
372(@pxref{Other Window}).
373 353
374@node Completion Options 354@node Completion Options
375@subsection Completion Options 355@subsection Completion Options
376 356
377@vindex completion-ignored-extensions 357@vindex completion-ignored-extensions
378@cindex ignored file names, in completion 358@cindex ignored file names, in completion
379 When completion is done on file names, certain file names are usually 359 When completing file names, certain file names are usually ignored.
380ignored. The variable @code{completion-ignored-extensions} contains a 360The variable @code{completion-ignored-extensions} contains a list of
381list of strings; a file whose name ends in any of those strings is 361strings; a file name ending in any of those strings is ignored as a
382ignored as a possible completion. The standard value of this variable 362completion candidate. The standard value of this variable has several
383has several elements including @code{".o"}, @code{".elc"}, @code{".dvi"} 363elements including @code{".o"}, @code{".elc"}, @code{".dvi"} and
384and @code{"~"}. The effect is that, for example, @samp{foo} can 364@code{"~"}. The effect is that, for example, @samp{foo} can complete
385complete to @samp{foo.c} even though @samp{foo.o} exists as well. 365to @samp{foo.c} even though @samp{foo.o} exists as well. However, if
386However, if @emph{all} the possible completions end in ``ignored'' 366@emph{all} the possible completions end in ``ignored'' strings, then
387strings, then they are not ignored. Ignored extensions do not apply to 367they are not ignored. Displaying a list of possible completions
388lists of completions---those always mention all possible completions. 368disregards @code{completion-ignored-extensions}; it shows them all.
389 369
390 If an element of the list in @code{completion-ignored-extensions} ends 370 If an element of @code{completion-ignored-extensions} ends in a
391in a slash @file{/}, it indicates a subdirectory that should be ignored 371slash (@file{/}), it's a subdirectory name; then that directory and
392when completing file names. Elements of 372its contents are ignored. Elements of
393@code{completion-ignored-extensions} which do not end in a slash are 373@code{completion-ignored-extensions} which do not end in a slash are
394never considered when a completion candidate is a directory; thus, 374ordinary file names, and do not apply to names of directories.
395completion returns directories whose names end in @file{.elc} even
396though there's an element @code{".elc"} in the list.
397 375
398@vindex completion-auto-help 376@vindex completion-auto-help
399 Normally, a completion command that cannot determine even one 377 If @code{completion-auto-help} is set to @code{nil}, the completion
400additional character automatically displays a list of all possible 378commands never display a list of possibilities; you must type @kbd{?}
401completions. If the variable @code{completion-auto-help} is set to 379to display the list.
402@code{nil}, this automatic display is disabled, so you must type
403@kbd{?} to display the list of completions.
404 380
405@cindex Partial Completion mode 381@cindex Partial Completion mode
406@vindex partial-completion-mode 382@vindex partial-completion-mode
@@ -408,30 +384,29 @@ completions. If the variable @code{completion-auto-help} is set to
408 Partial Completion mode implements a more powerful kind of 384 Partial Completion mode implements a more powerful kind of
409completion that can complete multiple words in parallel. For example, 385completion that can complete multiple words in parallel. For example,
410it can complete the command name abbreviation @code{p-b} into 386it can complete the command name abbreviation @code{p-b} into
411@code{print-buffer}, because no other command starts with two words 387@code{print-buffer} if no other command starts with two words whose
412whose initials are @samp{p} and @samp{b}. 388initials are @samp{p} and @samp{b}.
389
390 To enable this mode, use @kbd{M-x partial-completion-mode}, or
391customize the variable @code{partial-completion-mode}. This mode
392binds special partial completion commands to @key{TAB}, @key{SPC},
393@key{RET}, and @kbd{?} in the minibuffer. The usual completion
394commands are available on @kbd{M-@key{TAB}} (or @kbd{C-M-i}),
395@kbd{M-@key{SPC}}, @kbd{M-@key{RET}} and @kbd{M-?}.
413 396
414 Partial completion of directories in file names uses @samp{*} to 397 Partial completion of directories in file names uses @samp{*} to
415indicate the places for completion; thus, @file{/u*/b*/f*} might 398indicate the places for completion; thus, @file{/u*/b*/f*} might
416complete to @file{/usr/bin/foo}. 399complete to @file{/usr/bin/foo}. For remote files, partial completion
417 400enables completion of methods, user names and host names.
418 For remote files, partial completion enables completion of methods, 401@xref{Remote Files}.
419user names and host names. @xref{Remote Files}.
420
421 To enable this mode, use the command @kbd{M-x
422partial-completion-mode}, or customize the variable
423@code{partial-completion-mode}. This binds the partial completion
424commands to @key{TAB}, @key{SPC}, @key{RET}, and @kbd{?}. The usual
425completion commands are available on @kbd{M-@key{TAB}} (or
426@kbd{C-M-i}), @kbd{M-@key{SPC}}, @kbd{M-@key{RET}} and @kbd{M-?}.
427 402
428@vindex PC-include-file-path 403@vindex PC-include-file-path
429@vindex PC-disable-includes 404@vindex PC-disable-includes
430 Another feature of Partial Completion mode is to extend 405 Partial Completion mode also extends @code{find-file} so that
431@code{find-file} so that @samp{<@var{include}>} stands for the 406@samp{<@var{include}>} looks for the file named @var{include} in the
432file named @var{include} in some directory in the path 407directories in the path @code{PC-include-file-path}. If you set
433@code{PC-include-file-path}. If you set @code{PC-disable-includes} to 408@code{PC-disable-includes} to non-@code{nil}, this feature is
434non-@code{nil}, this feature is disabled. 409disabled.
435 410
436@cindex Icomplete mode 411@cindex Icomplete mode
437@findex icomplete-mode 412@findex icomplete-mode
@@ -446,52 +421,50 @@ icomplete-mode}.
446@cindex history of minibuffer input 421@cindex history of minibuffer input
447 422
448 Every argument that you enter with the minibuffer is saved on a 423 Every argument that you enter with the minibuffer is saved on a
449@dfn{minibuffer history list} so that you can use it again later in 424@dfn{minibuffer history list} so you can easily use it again later.
450another argument. Special commands load the text of an earlier argument 425Special commands fetch the text of an earlier argument into the
451in the minibuffer. They discard the old minibuffer contents, so you can 426minibuffer, replacing the old minibuffer contents. You can think of
452think of them as moving through the history of previous arguments. 427them as moving through the history of previous arguments.
453 428
454@table @kbd 429@table @kbd
455@item @key{UP} 430@item @key{UP}
456@itemx M-p 431@itemx M-p
457Move to the next earlier argument string saved in the minibuffer history 432Move to the previous item in the minibuffer history, an earlier argument
458(@code{previous-history-element}). 433(@code{previous-history-element}).
459@item @key{DOWN} 434@item @key{DOWN}
460@itemx M-n 435@itemx M-n
461Move to the next later argument string saved in the minibuffer history 436Move to the next item in the minibuffer history
462(@code{next-history-element}). 437(@code{next-history-element}).
463@item M-r @var{regexp} @key{RET} 438@item M-r @var{regexp} @key{RET}
464Move to an earlier saved argument in the minibuffer history that has a 439Move to an earlier item in the minibuffer history that
465match for @var{regexp} (@code{previous-matching-history-element}). 440matches @var{regexp} (@code{previous-matching-history-element}).
466@item M-s @var{regexp} @key{RET} 441@item M-s @var{regexp} @key{RET}
467Move to a later saved argument in the minibuffer history that has a 442Move to a later item in the minibuffer history that matches
468match for @var{regexp} (@code{next-matching-history-element}). 443@var{regexp} (@code{next-matching-history-element}).
469@end table 444@end table
470 445
471@kindex M-p @r{(minibuffer history)} 446@kindex M-p @r{(minibuffer history)}
472@kindex M-n @r{(minibuffer history)} 447@kindex M-n @r{(minibuffer history)}
473@findex next-history-element 448@findex next-history-element
474@findex previous-history-element 449@findex previous-history-element
475 The simplest way to reuse the saved arguments in the history list is 450 To move through the minibuffer history list one item at a time, use
476to move through the history list one element at a time. While in the 451@kbd{M-p} or up-arrow (@code{previous-history-element}) to fetch the
477minibuffer, use @kbd{M-p} or up-arrow 452next earlier minibuffer input, and use @kbd{M-n} or down-arrow
478(@code{previous-history-element}) to ``move to'' the next earlier 453(@code{next-history-element}) to fetch the next later input. These
479minibuffer input, and use @kbd{M-n} or down-arrow 454commands don't move the cursor, they pull different saved strings into
480(@code{next-history-element}) to ``move to'' the next later input. 455the minibuffer. But you can think of them as ``moving'' through the
481These commands don't move the cursor, they bring different saved 456history list.
482strings into the minibuffer. But you can think of them as ``moving'' 457
483through the history list. 458 The input that you fetch from the history entirely replaces the
484 459contents of the minibuffer. To use it again unchanged, just type
485 The previous input that you fetch from the history entirely replaces 460@key{RET}. You can also edit the text before you reuse it; this does
486the contents of the minibuffer. To use it as the argument, exit the 461not change the history element that you ``moved'' to, but your new
487minibuffer as usual with @key{RET}. You can also edit the text before 462argument does go at the end of the history list in its own right.
488you reuse it; this does not change the history element that you 463
489``moved'' to, but your new argument does go at the end of the history 464 For many minibuffer arguments there is a ``default'' value. You can
490list in its own right. 465insert the default value into the minibuffer as text by using
491 466@kbd{M-n}. You can think of this as moving ``into the future'' in the
492 For many minibuffer arguments there is a ``default'' value. Then 467history.
493you can insert the default value into the minibuffer as text by using
494@kbd{M-n} to move ``into the future'' in the history.
495 468
496@findex previous-matching-history-element 469@findex previous-matching-history-element
497@findex next-matching-history-element 470@findex next-matching-history-element
@@ -499,14 +472,13 @@ you can insert the default value into the minibuffer as text by using
499@kindex M-s @r{(minibuffer history)} 472@kindex M-s @r{(minibuffer history)}
500 There are also commands to search forward or backward through the 473 There are also commands to search forward or backward through the
501history; they search for history elements that match a regular 474history; they search for history elements that match a regular
502expression that you specify with the minibuffer. @kbd{M-r} 475expression. @kbd{M-r} (@code{previous-matching-history-element})
503(@code{previous-matching-history-element}) searches older elements in 476searches older elements in the history, while @kbd{M-s}
504the history, while @kbd{M-s} (@code{next-matching-history-element}) 477(@code{next-matching-history-element}) searches newer elements. These
505searches newer elements. By special dispensation, these commands can 478commands are unusual; they use the minibuffer to read the regular
506use the minibuffer to read their arguments even though you are already 479expression even though they are invoked from the minibuffer. As with
507in the minibuffer when you issue them. As with incremental searching, 480incremental searching, an upper-case letter in the regular expression
508an upper-case letter in the regular expression makes the search 481makes the search case-sensitive (@pxref{Search Case}).
509case-sensitive (@pxref{Search Case}).
510 482
511@ignore 483@ignore
512 We may change the precise way these commands read their arguments. 484 We may change the precise way these commands read their arguments.
@@ -519,46 +491,45 @@ actually available, type @kbd{C-h f previous-matching-history-element}.
519@end ignore 491@end ignore
520 492
521 All uses of the minibuffer record your input on a history list, but 493 All uses of the minibuffer record your input on a history list, but
522there are separate history lists for different kinds of arguments. For 494there are separate history lists for different kinds of arguments.
523example, there is a list for file names, used by all the commands that 495For example, there is a list for file names, used by all the commands
524read file names. (As a special feature, this history list records 496that read file names. (As a special feature, this history list
525the absolute file name, no more and no less, even if that is not how 497records the absolute file name, even if the name you entered was not
526you entered the file name.) 498absolute.)
527 499
528 There are several other very specific history lists, including one for 500 There are several other specific history lists, including one for
529command names read by @kbd{M-x}, one for buffer names, one for arguments 501buffer names, one for arguments of commands like @code{query-replace},
530of commands like @code{query-replace}, and one for compilation commands 502one used by @kbd{M-x} for command names, and one used by
531read by @code{compile}. Finally, there is one ``miscellaneous'' history 503@code{compile} for compilation commands. Finally, there is one
532list that most minibuffer arguments use. 504``miscellaneous'' history list that most minibuffer arguments use.
533 505
534@vindex history-length 506@vindex history-length
535 The variable @code{history-length} specifies the maximum length of a 507 The variable @code{history-length} specifies the maximum length of a
536minibuffer history list; once a list gets that long, the oldest element 508minibuffer history list; adding a new element deletes the oldest
537is deleted each time an element is added. If the value of 509element if the list gets too long. If the value of
538@code{history-length} is @code{t}, though, there is no maximum length 510@code{history-length} is @code{t}, though, there is no maximum length.
539and elements are never deleted.
540 511
541@vindex history-delete-duplicates 512@vindex history-delete-duplicates
542 The variable @code{history-delete-duplicates} specifies whether to 513 The variable @code{history-delete-duplicates} specifies whether to
543delete duplicates in history. If the value of @code{history-delete-duplicates} 514delete duplicates in history. If it is @code{t}, adding a new element
544is @code{t}, that means when adding a new history element, all 515deletes from the list all other elements that are equal to it.
545previous identical elements are deleted.
546 516
547@node Repetition 517@node Repetition
548@section Repeating Minibuffer Commands 518@section Repeating Minibuffer Commands
549@cindex command history 519@cindex command history
550@cindex history of commands 520@cindex history of commands
551 521
552 Every command that uses the minibuffer at least once is recorded on a 522 Every command that uses the minibuffer once is recorded on a special
553special history list, together with the values of its arguments, so that 523history list, the @dfn{command history}, together with the values of
554you can repeat the entire command. In particular, every use of 524its arguments, so that you can repeat the entire command. In
555@kbd{M-x} is recorded there, since @kbd{M-x} uses the minibuffer to read 525particular, every use of @kbd{M-x} is recorded there, since @kbd{M-x}
556the command name. 526uses the minibuffer to read the command name.
557 527
558@findex list-command-history 528@findex list-command-history
559@table @kbd 529@table @kbd
560@item C-x @key{ESC} @key{ESC} 530@item C-x @key{ESC} @key{ESC}
561Re-execute a recent minibuffer command (@code{repeat-complex-command}). 531Re-execute a recent minibuffer command from the command history
532 (@code{repeat-complex-command}).
562@item M-x list-command-history 533@item M-x list-command-history
563Display the entire command history, showing all the commands 534Display the entire command history, showing all the commands
564@kbd{C-x @key{ESC} @key{ESC}} can repeat, most recent first. 535@kbd{C-x @key{ESC} @key{ESC}} can repeat, most recent first.
@@ -566,36 +537,33 @@ Display the entire command history, showing all the commands
566 537
567@kindex C-x ESC ESC 538@kindex C-x ESC ESC
568@findex repeat-complex-command 539@findex repeat-complex-command
569 @kbd{C-x @key{ESC} @key{ESC}} is used to re-execute a recent 540 @kbd{C-x @key{ESC} @key{ESC}} is used to re-execute a recent command
570minibuffer-using command. With no argument, it repeats the last such 541that used the minibuffer. With no argument, it repeats the last such
571command. A numeric argument specifies which command to repeat; one 542command. A numeric argument specifies which command to repeat; 1
572means the last one, and larger numbers specify earlier ones. 543means the last one, 2 the previous, and so on.
573 544
574 @kbd{C-x @key{ESC} @key{ESC}} works by turning the previous command 545 @kbd{C-x @key{ESC} @key{ESC}} works by turning the previous command
575into a Lisp expression and then entering a minibuffer initialized with 546into a Lisp expression and then entering a minibuffer initialized with
576the text for that expression. If you type just @key{RET}, the command 547the text for that expression. Even if you don't understand Lisp
577is repeated as before. You can also change the command by editing the 548syntax, it will probably be obvious which command is displayed for
578Lisp expression. Whatever expression you finally submit is what will be 549repetition. If you type just @key{RET}, that repeats the command
579executed. The repeated command is added to the front of the command 550unchanged. You can also change the command by editing the Lisp
580history unless it is identical to the most recently executed command 551expression before you execute it. The repeated command is added to
581already there. 552the front of the command history unless it is identical to the most
582 553recently item.
583 Even if you don't understand Lisp syntax, it will probably be obvious
584which command is displayed for repetition. If you do not change the
585text, it will repeat exactly as before.
586 554
587 Once inside the minibuffer for @kbd{C-x @key{ESC} @key{ESC}}, you can 555 Once inside the minibuffer for @kbd{C-x @key{ESC} @key{ESC}}, you can
588use the minibuffer history commands (@kbd{M-p}, @kbd{M-n}, @kbd{M-r}, 556use the minibuffer history commands (@kbd{M-p}, @kbd{M-n}, @kbd{M-r},
589@kbd{M-s}; @pxref{Minibuffer History}) to move through the history list 557@kbd{M-s}; @pxref{Minibuffer History}) to move through the history list
590of saved entire commands. After finding the desired previous command, 558of saved entire commands. After finding the desired previous command,
591you can edit its expression as usual and then resubmit it by typing 559you can edit its expression as usual and then repeat it by typing
592@key{RET} as usual. 560@key{RET}.
593 561
594@vindex isearch-resume-in-command-history 562@vindex isearch-resume-in-command-history
595 Incremental search does not, strictly speaking, use the minibuffer, 563 Incremental search does not, strictly speaking, use the minibuffer.
596but it does something similar. Although it behaves like a complex command, 564Therefore, although it behaves like a complex command, it normally
597it normally does not appear in the history list for @kbd{C-x 565does not appear in the history list for @kbd{C-x @key{ESC} @key{ESC}}.
598@key{ESC} @key{ESC}}. You can make it appear in the history by 566You can make incremental search commands appear in the history by
599setting @code{isearch-resume-in-command-history} to a non-@code{nil} 567setting @code{isearch-resume-in-command-history} to a non-@code{nil}
600value. @xref{Incremental Search}. 568value. @xref{Incremental Search}.
601 569