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