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