Remove duplicate words.
[bpt/emacs.git] / doc / emacs / mini.texi
1 @c This is part of the Emacs manual.
2 @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001,
3 @c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
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 where Emacs commands read complicated
10 arguments, such as file names, buffer names, Emacs command names, or
11 Lisp expressions. We call it the ``minibuffer'' because it's a
12 special-purpose buffer with a small amount of screen space. You can
13 use the usual Emacs editing commands in the minibuffer to edit the
14 argument text.
15
16 @cindex prompt
17 When the minibuffer is in use, it appears in the echo area, with a
18 cursor. The minibuffer display starts with a @dfn{prompt} in a
19 distinct color, usually ending with a colon. The prompt states what
20 kind of input is expected, and how it will be used.
21
22 The simplest way to enter a minibuffer argument is to type the text,
23 then @key{RET} to submit the argument and exit the minibuffer. You
24 can cancel the minibuffer, and the command that wants the argument, by
25 typing @kbd{C-g}.
26
27 @cindex default argument
28 Sometimes, a @dfn{default argument} appears in the prompt, inside
29 parentheses before the colon. The default will be used as the
30 argument value if you just type @key{RET}. For example, commands that
31 read buffer names usually show a buffer name as the default; you can
32 type @key{RET} to operate on that default buffer.
33
34 Since the minibuffer appears in the echo area, it can conflict with
35 other uses of the echo area. If an error occurs while the minibuffer
36 is active, the error message hides the minibuffer for a few seconds,
37 or until you type something; then the minibuffer comes back. If a
38 command such as @kbd{C-x =} needs to display a message in the echo
39 area, the message hides the minibuffer for a few seconds, or until you
40 type something; then the minibuffer comes back. While the minibuffer
41 is in use, keystrokes do not echo.
42
43 @menu
44 * Minibuffer File:: Entering file names with the minibuffer.
45 * Minibuffer Edit:: How to edit in the minibuffer.
46 * Completion:: An abbreviation facility for minibuffer input.
47 * Minibuffer History:: Reusing recent minibuffer arguments.
48 * Repetition:: Re-executing commands that used the minibuffer.
49 * Passwords:: Entering passwords in the echo area.
50 @end menu
51
52 @node Minibuffer File
53 @section Minibuffers for File Names
54
55 Commands such as @kbd{C-x C-f} (@code{find-file}) use the minibuffer
56 to read a file name argument (@pxref{Basic Files}). When the
57 minibuffer is used to read a file name, it typically starts out with
58 some initial text ending in a slash. This is the @dfn{default
59 directory}. For example, it may start out like this:
60
61 @example
62 Find File: /u2/emacs/src/
63 @end example
64
65 @noindent
66 Here, @samp{Find File:@: } is the prompt and @samp{/u2/emacs/src/} is
67 the default directory. If you now type @kbd{buffer.c} as input, that
68 specifies the file @file{/u2/emacs/src/buffer.c}. @xref{File Names},
69 for information about the default directory.
70
71 You can specify the parent directory by adding @file{..}: for
72 example, @file{/u2/emacs/src/../lisp/simple.el} is equivalent to
73 @file{/u2/emacs/lisp/simple.el}. Alternatively, you can use
74 @kbd{M-@key{DEL}} to kill directory names backwards (@pxref{Words}).
75
76 To specify a file in a completely different directory, you can kill
77 the entire default with @kbd{C-a C-k} (@pxref{Minibuffer Edit}).
78 Alternatively, you can ignore the default, and enter an absolute file
79 name starting with a slash or a tilde after the default directory.
80 For example, you can specify @file{/etc/termcap} as follows:
81
82 @example
83 Find File: /u2/emacs/src//etc/termcap
84 @end example
85
86 @noindent
87 @cindex // in file name
88 @cindex double slash in file name
89 @cindex slashes repeated in file name
90 @findex file-name-shadow-mode
91 Emacs interprets a double slash as ``ignore everything before the
92 second slash in the pair.'' In the example above,
93 @file{/u2/emacs/src/} is ignored, so the argument you supplied is
94 @file{/etc/termcap}. The ignored part of the file name is dimmed if
95 the terminal allows it (to disable this dimming, turn off File Name
96 Shadow mode with the command @kbd{M-x file-name-shadow-mode}.)
97
98 @cindex home directory shorthand
99 Emacs interprets @file{~/} as your home directory. Thus,
100 @file{~/foo/bar.txt} specifies a file named @file{bar.txt}, inside a
101 directory named @file{foo}, which is in turn located in your home
102 directory. In addition, @file{~@var{user-id}/} means the home
103 directory of a user whose login name is @var{user-id}. Any leading
104 directory name in front of the @file{~} is ignored: thus,
105 @file{/u2/emacs/~/foo/bar.txt} is equivalent to @file{~/foo/bar.txt}.
106
107 On MS-Windows and MS-DOS systems, where a user doesn't always have a
108 home directory, Emacs uses several alternatives. For MS-Windows, see
109 @ref{Windows HOME}; for MS-DOS, see
110 @ifnottex
111 @ref{MS-DOS File Names, HOME on MS-DOS}.
112 @end ifnottex
113 @iftex
114 @ref{MS-DOS File Names, HOME on MS-DOS,, emacs, the Emacs Manual}, in
115 the main Emacs manual.
116 @end iftex
117 On these systems, the @file{~@var{user-id}/} construct is supported
118 only for the current user, i.e., only if @var{user-id} is the current
119 user's login name.
120
121 @vindex insert-default-directory
122 To prevent Emacs from inserting the default directory when reading
123 file names, change the variable @code{insert-default-directory} to
124 @code{nil}. In that case, the minibuffer starts out empty.
125 Nonetheless, relative file name arguments are still interpreted based
126 on the same default directory.
127
128 @node Minibuffer Edit
129 @section Editing in the Minibuffer
130
131 The minibuffer is an Emacs buffer, albeit a peculiar one, and the
132 usual Emacs commands are available for editing the argument text.
133 (The prompt, however, is @dfn{read-only}, and cannot be changed.)
134
135 Since @key{RET} in the minibuffer is defined to exit the minibuffer,
136 you can't use it to insert a newline in the minibuffer. To do that,
137 type @kbd{C-o} or @kbd{C-q C-j}. (The newline character is really the
138 @acronym{ASCII} character control-J.)
139
140 Inside a minibuffer, the keys @kbd{@key{TAB}}, @kbd{@key{SPC}}, and
141 @kbd{@key{?}} are often bound to commands that perform
142 @dfn{completion}. @xref{Completion}. You can use @kbd{C-q}
143 (@code{quoted-insert}) to insert a @key{TAB}, @key{SPC}, or @key{?}
144 character. For example, @kbd{C-q @key{TAB}} inserts a @key{TAB}
145 character. @xref{Inserting Text}.
146
147 For convenience, @kbd{C-a} (@code{move-beginning-of-line}) in a
148 minibuffer moves point to the beginning of the argument text, not the
149 beginning of the prompt. For example, this allows you to erase the
150 entire argument with @kbd{C-a C-k}.
151
152 @cindex height of minibuffer
153 @cindex size of minibuffer
154 @cindex growing minibuffer
155 @cindex resizing minibuffer
156 When the minibuffer is active, the echo area is treated much like an
157 ordinary Emacs window. For instance, you can switch to another window
158 (with @kbd{C-x o}), edit text there, then return to the minibuffer
159 window to finish the argument. You can even kill text in another
160 window, return to the minibuffer window, and yank the text into the
161 argument. There are some restrictions on the minibuffer window,
162 however: for instance, you cannot split it. @xref{Windows}.
163
164 @vindex resize-mini-windows
165 Normally, the minibuffer window occupies a single screen line.
166 However, if you add two or more lines' worth of text into the
167 minibuffer, it expands automatically to accomodate the text. The
168 variable @code{resize-mini-windows} controls the resizing of the
169 minibuffer. The default value is @code{grow-only}, which means the
170 behavior we have just described. If the value is @code{t}, the
171 minibuffer window will also shrink automatically if you remove some
172 lines of text from the minibuffer, down to a minimum of one screen
173 line. If the value is @code{nil}, the minibuffer window never changes
174 size automatically, but you can use the usual window-resizing commands
175 on it (@pxref{Windows}).
176
177 @vindex max-mini-window-height
178 The variable @code{max-mini-window-height} controls the maximum
179 height for resizing the minibuffer window. A floating-point number
180 specifies a fraction of the frame's height; an integer specifies the
181 maximum number of lines; @code{nil} means do not resize the minibuffer
182 window automatically. The default value is 0.25.
183
184 The @kbd{C-M-v} command in the minibuffer scrolls the help text from
185 commands that display help text of any sort in another window.
186 @kbd{M-@key{PAGEUP}} and @kbd{M-@key{PAGEDOWN}} also operate on that
187 help text. This is especially useful with long lists of possible
188 completions. @xref{Other Window}.
189
190 @vindex enable-recursive-minibuffers
191 Emacs normally disallows most commands that use the minibuffer while
192 the minibuffer is active. To allow such commands in the minibuffer,
193 set the variable @code{enable-recursive-minibuffers} to @code{t}.
194
195 @node Completion
196 @section Completion
197 @c This node is referenced in the tutorial. When renaming or deleting
198 @c it, the tutorial needs to be adjusted.
199 @cindex completion
200
201 Sometimes, you can use a feature called @dfn{completion} to help you
202 enter arguments. This means that after you type part of the argument,
203 Emacs can fill in the rest, or some of it, based on what you have
204 typed so far.
205
206 When completion is available, certain keys (usually @key{TAB},
207 @key{RET}, and @key{SPC}) are rebound to complete the text in the
208 minibuffer into a longer string chosen from a set of @dfn{completion
209 alternatives}. The set of completion alternatives depends on the
210 command that requested the argument, and on what you have typed so
211 far. In addition, you can usually type @kbd{?} to display a list of
212 possible completions.
213
214 For example, @kbd{M-x} uses the minibuffer to read the name of a
215 command, so completion works by matching the minibuffer text against
216 the names of existing Emacs commands. So, to run the command
217 @code{insert-buffer}, you can type @kbd{M-x ins @key{SPC} b @key{RET}}
218 instead of the full @kbd{M-x insert-buffer @key{RET}}.
219
220 Case is significant in completion when it is significant in the
221 argument you are entering, such as command names. Thus,
222 @samp{insert-buffer} is not a valid completion for @samp{IN}.
223 Completion ignores case distinctions for certain arguments in which
224 case does not matter.
225
226 @menu
227 * Example: Completion Example. Examples of using completion.
228 * Commands: Completion Commands. A list of completion commands.
229 * Strict Completion:: Different types of completion.
230 * Options: Completion Options. Options for completion.
231 @end menu
232
233 @node Completion Example
234 @subsection Completion Example
235
236 @kindex TAB @r{(completion)}
237 A concrete example may help here. If you type @kbd{M-x a u
238 @key{TAB}}, the @key{TAB} looks for alternatives (in this case,
239 command names) that start with @samp{au}. There are several,
240 including @code{auto-fill-mode} and @code{autoconf-mode}, but they all
241 begin with @code{auto}, so the @samp{au} in the minibuffer completes
242 to @samp{auto}.
243
244 If you type @key{TAB} again immediately, it cannot determine the
245 next character; it could be @samp{-}, @samp{a}, or @samp{c}. So it
246 does not add any characters; instead, @key{TAB} displays a list of all
247 possible completions in another window.
248
249 Next, type @kbd{- f}. The minibuffer now contains @samp{auto-f},
250 and the only command name that starts with this is
251 @code{auto-fill-mode}. If you now type @key{TAB}, completion fills in
252 the rest of the argument @samp{auto-fill-mode} into the minibuffer.
253 You have been able to enter @samp{auto-fill-mode} by typing just
254 @kbd{a u @key{TAB} - f @key{TAB}}.
255
256 @node Completion Commands
257 @subsection Completion Commands
258
259 Here is a list of the completion commands defined in the minibuffer
260 when completion is allowed.
261
262 @table @kbd
263 @item @key{TAB}
264 @findex minibuffer-complete
265 Complete the text before point in the minibuffer as much as possible;
266 if unable to complete, display a list of possible completions
267 (@code{minibuffer-complete}).
268 @item @key{SPC}
269 Complete up to one word from the minibuffer text before point
270 (@code{minibuffer-complete-word}). @key{SPC} for completion is not
271 available when entering a file name, since file names often include
272 spaces.
273 @item @key{RET}
274 Submit the text in the minibuffer as the argument, possibly completing
275 first as described in the next
276 @iftex
277 subsection (@code{minibuffer-complete-and-exit}).
278 @end iftex
279 @ifnottex
280 node (@code{minibuffer-complete-and-exit}). @xref{Strict Completion}.
281 @end ifnottex
282 @item ?
283 Display a list of possible completions of the text before point
284 (@code{minibuffer-completion-help}).
285 @end table
286
287 @kindex SPC
288 @findex minibuffer-complete-word
289 @key{SPC} (@code{minibuffer-complete-word}) completes like
290 @key{TAB}, but only up to the next hyphen or space. If you have
291 @samp{auto-f} in the minibuffer and type @key{SPC}, it finds that the
292 completion is @samp{auto-fill-mode}, but it only inserts @samp{ill-},
293 giving @samp{auto-fill-}. Another @key{SPC} at this point completes
294 all the way to @samp{auto-fill-mode}.
295
296 When you display a list of possible completions, you can choose
297 one from it:
298
299 @table @kbd
300 @findex mouse-choose-completion
301 @item Mouse-1
302 @itemx Mouse-2
303 Clicking mouse button 1 or 2 on a completion possibility chooses that
304 completion (@code{mouse-choose-completion}).
305
306 @findex switch-to-completions
307 @item M-v
308 @itemx @key{PageUp}
309 @itemx @key{PRIOR}
310 Typing @kbd{M-v}, while in the minibuffer, selects the window showing
311 the completion list buffer (@code{switch-to-completions}). This paves
312 the way for using the commands below. Typing @key{PageUp} or
313 @key{PRIOR} does the same, as does selecting that window in other
314 ways.
315
316 @findex choose-completion
317 @item @key{RET}
318 Typing @key{RET}, while in the completion list buffer, chooses the
319 completion that point is in or next to (@code{choose-completion}). To
320 use this command, you must first switch to the completion list window.
321
322 @findex next-completion
323 @item @key{Right}
324 Typing the right-arrow key @key{Right}, while in the completion list
325 buffer, moves point to the following completion possibility
326 (@code{next-completion}).
327
328 @findex previous-completion
329 @item @key{Left}
330 Typing the left-arrow key @key{Left}, while in the completion list
331 buffer, moves point to the previous completion possibility
332 (@code{previous-completion}).
333 @end table
334
335 @node Strict Completion
336 @subsection Strict Completion
337
338 There are three different ways that @key{RET} can do completion,
339 depending on how the argument will be used.
340
341 @itemize @bullet
342 @item
343 @dfn{Strict} completion accepts only known completion candidates. For
344 example, when @kbd{C-x k} reads the name of a buffer to kill, only the
345 name of an existing buffer makes sense. In strict completion,
346 @key{RET} refuses to exit if the text in the minibuffer does not
347 complete to an exact match.
348
349 @item
350 @dfn{Cautious} completion is similar to strict completion, except that
351 @key{RET} exits only if the text is an already exact match.
352 Otherwise, @key{RET} does not exit, but it does complete the text. If
353 that completes to an exact match, a second @key{RET} will exit.
354
355 Cautious completion is used for reading file names for files that must
356 already exist, for example.
357
358 @item
359 @dfn{Permissive} completion allows any input; the completion
360 candidates are just suggestions. For example, when @kbd{C-x C-f}
361 reads the name of a file to visit, any file name is allowed, including
362 nonexistent file (in case you want to create a file). In permissive
363 completion, @key{RET} does not complete, it just submits the argument
364 as you have entered it.
365 @end itemize
366
367 The completion commands display a list of all possible completions
368 whenever they can't determine even one more character by completion.
369 Also, typing @kbd{?} explicitly requests such a list. You can scroll
370 the list with @kbd{C-M-v} (@pxref{Other Window}).
371
372 @node Completion Options
373 @subsection Completion Options
374
375 @vindex completion-auto-help
376 If @code{completion-auto-help} is set to @code{nil}, the completion
377 commands never display the completion list buffer; you must type
378 @kbd{?} to display the list. If the value is @code{lazy}, Emacs only
379 shows the completion list buffer on the second attempt to complete.
380 In other words, if there is nothing to complete, the first @key{TAB}
381 echoes @samp{Next char not unique}; the second @key{TAB} does the
382 completion list buffer.
383
384 @vindex completion-ignored-extensions
385 @cindex ignored file names, in completion
386 When completing file names, certain file names are usually ignored.
387 The variable @code{completion-ignored-extensions} contains a list of
388 strings; a file name ending in any of those strings is ignored as a
389 completion candidate. The standard value of this variable has several
390 elements including @code{".o"}, @code{".elc"}, and @code{"~"}. For
391 example, if a directory contains @samp{foo.c} and @samp{foo.elc},
392 @samp{foo} completes to @samp{foo.c}. However, if @emph{all} possible
393 completions end in ``ignored'' strings, they are not ignored: in the
394 previous example, @samp{foo.e} completes to @samp{foo.elc}.
395 Displaying a list of possible completions disregards
396 @code{completion-ignored-extensions}; it shows them all.
397
398 If an element of @code{completion-ignored-extensions} ends in a
399 slash (@file{/}), it's a subdirectory name; that directory and its
400 contents are ignored. Elements of
401 @code{completion-ignored-extensions} that do not end in a slash are
402 ordinary file names.
403
404 @cindex Partial Completion mode
405 @vindex partial-completion-mode
406 @findex partial-completion-mode
407 Partial Completion mode implements a more powerful kind of
408 completion that can complete multiple words in parallel. For example,
409 it can complete the command name abbreviation @code{p-b} into
410 @code{print-buffer} if no other command starts with two words whose
411 initials are @samp{p} and @samp{b}.
412
413 To enable this mode, use @kbd{M-x partial-completion-mode} or
414 customize the variable @code{partial-completion-mode}. This mode
415 binds special partial completion commands to @key{TAB}, @key{SPC},
416 @key{RET}, and @kbd{?} in the minibuffer. The usual completion
417 commands are available on @kbd{M-@key{TAB}} (or @kbd{C-M-i}),
418 @kbd{M-@key{SPC}}, @kbd{M-@key{RET}} and @kbd{M-?}.
419
420 Partial completion of directories in file names uses @samp{*} to
421 indicate the places for completion; thus, @file{/u*/b*/f*} might
422 complete to @file{/usr/bin/foo}. For remote files, partial completion
423 enables completion of methods, user names and host names.
424 @xref{Remote Files}.
425
426 @vindex PC-include-file-path
427 @vindex PC-disable-includes
428 Partial Completion mode also extends @code{find-file} so that
429 @samp{<@var{include}>} looks for the file named @var{include} in the
430 directories in the path @code{PC-include-file-path}. If you set
431 @code{PC-disable-includes} to non-@code{nil}, this feature is
432 disabled.
433
434 @cindex Icomplete mode
435 @findex icomplete-mode
436 Icomplete mode presents a constantly-updated display that tells you
437 what completions are available for the text you've entered so far. The
438 command to enable or disable this minor mode is @kbd{M-x
439 icomplete-mode}.
440
441 @node Minibuffer History
442 @section Minibuffer History
443 @cindex minibuffer history
444 @cindex history of minibuffer input
445
446 Every argument that you enter with the minibuffer is saved in a
447 @dfn{minibuffer history list} so you can easily use it again later.
448 You can use the following arguments to quickly fetch an earlier
449 argument into the minibuffer:
450
451 @table @kbd
452 @item M-p
453 @itemx @key{Up}
454 Move to the previous item in the minibuffer history, an earlier
455 argument (@code{previous-history-element}).
456 @item M-n
457 @itemx @key{Down}
458 Move to the next item in the minibuffer history
459 (@code{next-history-element}).
460 @item M-r @var{regexp} @key{RET}
461 Move to an earlier item in the minibuffer history that
462 matches @var{regexp} (@code{previous-matching-history-element}).
463 @item M-s @var{regexp} @key{RET}
464 Move to a later item in the minibuffer history that matches
465 @var{regexp} (@code{next-matching-history-element}).
466 @end table
467
468 @kindex M-p @r{(minibuffer history)}
469 @kindex M-n @r{(minibuffer history)}
470 @findex next-history-element
471 @findex previous-history-element
472 While in the minibuffer, typing @kbd{M-p} or @key{Up}
473 (@code{previous-history-element}) moves up through the minibuffer
474 history list, one item at a time. Each @kbd{M-p} fetches an earlier
475 item from the history list into the minibuffer, replacing its existing
476 contents. Similarly, typing @kbd{M-n} or @key{Down}
477 (@code{next-history-element}) moves back down the history list,
478 fetching later entries into the minibuffer. You can think of these
479 commands as ``backwards'' and ``forwards'' through the history list.
480
481 If you type @kbd{M-n} in the minibuffer when there are no later
482 entries in the minibuffer history (e.g., if you haven't previously
483 typed @kbd{M-p}), Emacs tries fetching from a list of default
484 argument: values that you are likely to enter. You can think of this
485 as moving through the ``future list'' instead of the ``history list''.
486
487 The input that @kbd{M-p} or @kbd{M-n} fetches into the minibuffer
488 entirely replaces the existing contents of the minibuffer, so you can
489 simply type @key{RET} to use it as an argument. You can also edit the
490 text before you reuse it; this does not change the history element
491 that you ``moved'' to, but your new argument does go at the end of the
492 history list in its own right.
493
494 @findex previous-matching-history-element
495 @findex next-matching-history-element
496 @kindex M-r @r{(minibuffer history)}
497 @kindex M-s @r{(minibuffer history)}
498 There are also commands to search forward or backward through the
499 history; they search for history elements that match a regular
500 expression. @kbd{M-r} (@code{previous-matching-history-element})
501 searches older elements in the history, while @kbd{M-s}
502 (@code{next-matching-history-element}) searches newer elements. These
503 commands are unusual: they use the minibuffer to read the regular
504 expression even though they are invoked from the minibuffer. As with
505 incremental searching, an upper-case letter in the regular expression
506 makes the search case-sensitive (@pxref{Search Case}). You can also
507 search through the history using an incremental search (@pxref{Isearch
508 Minibuffer}).
509
510 All uses of the minibuffer record your input on a history list, but
511 there are separate history lists for different kinds of arguments.
512 For example, there is a list for file names, used by all the commands
513 that read file names. (As a special feature, this history list
514 records the absolute file name, even if the name you entered was not
515 absolute.)
516
517 There are several other specific history lists, including one for
518 buffer names, one for arguments of commands like @code{query-replace},
519 one used by @kbd{M-x} for command names, and one used by
520 @code{compile} for compilation commands. Finally, there is one
521 ``miscellaneous'' history list that most minibuffer arguments use.
522
523 @vindex history-length
524 The variable @code{history-length} specifies the maximum length of a
525 minibuffer history list; adding a new element deletes the oldest
526 element if the list gets too long. If the value of
527 @code{history-length} is @code{t}, there is no maximum length.
528
529 @vindex history-delete-duplicates
530 The variable @code{history-delete-duplicates} specifies whether to
531 delete duplicates in history. If it is non-@code{nil}, adding a new
532 element deletes from the list all other elements that are equal to it.
533 The default is @code{nil}.
534
535 @node Repetition
536 @section Repeating Minibuffer Commands
537 @cindex command history
538 @cindex history of commands
539
540 Every command that uses the minibuffer once is recorded on a special
541 history list, the @dfn{command history}, together with the values of
542 its arguments, so that you can repeat the entire command. In
543 particular, every use of @kbd{M-x} is recorded there, since @kbd{M-x}
544 uses the minibuffer to read the command name.
545
546 @findex list-command-history
547 @table @kbd
548 @item C-x @key{ESC} @key{ESC}
549 Re-execute a recent minibuffer command from the command history
550 (@code{repeat-complex-command}).
551 @item M-x list-command-history
552 Display the entire command history, showing all the commands
553 @kbd{C-x @key{ESC} @key{ESC}} can repeat, most recent first.
554 @end table
555
556 @kindex C-x ESC ESC
557 @findex repeat-complex-command
558 @kbd{C-x @key{ESC} @key{ESC}} is used to re-execute a recent command
559 that used the minibuffer. With no argument, it repeats the last such
560 command. A numeric argument specifies which command to repeat; 1
561 means the last one, 2 the previous, and so on.
562
563 @kbd{C-x @key{ESC} @key{ESC}} works by turning the previous command
564 into a Lisp expression and then entering a minibuffer initialized with
565 the text for that expression. Even if you don't understand Lisp
566 syntax, it will probably be obvious which command is displayed for
567 repetition. If you type just @key{RET}, that repeats the command
568 unchanged. You can also change the command by editing the Lisp
569 expression before you execute it. The repeated command is added to
570 the front of the command history unless it is identical to the most
571 recently item.
572
573 Once inside the minibuffer for @kbd{C-x @key{ESC} @key{ESC}}, you can
574 use the minibuffer history commands (@kbd{M-p}, @kbd{M-n}, @kbd{M-r},
575 @kbd{M-s}; @pxref{Minibuffer History}) to move through the history list
576 of saved entire commands. After finding the desired previous command,
577 you can edit its expression as usual and then repeat it by typing
578 @key{RET}.
579
580 @vindex isearch-resume-in-command-history
581 Incremental search does not, strictly speaking, use the minibuffer.
582 Therefore, although it behaves like a complex command, it normally
583 does not appear in the history list for @kbd{C-x @key{ESC} @key{ESC}}.
584 You can make incremental search commands appear in the history by
585 setting @code{isearch-resume-in-command-history} to a non-@code{nil}
586 value. @xref{Incremental Search}.
587
588 @vindex command-history
589 The list of previous minibuffer-using commands is stored as a Lisp
590 list in the variable @code{command-history}. Each element is a Lisp
591 expression which describes one command and its arguments. Lisp programs
592 can re-execute a command by calling @code{eval} with the
593 @code{command-history} element.
594
595 @node Passwords
596 @section Entering passwords
597
598 Sometimes, you may need to enter a password into Emacs. For instance,
599 when you tell Emacs to visit a file on another machine via a network
600 protocol such as FTP, you often need to supply a password to gain
601 access to the machine (@pxref{Remote Files}).
602
603 Entering a password is, in a basic sense, similar to using a
604 minibuffer. Emacs displays a prompt in the echo area (such as
605 @samp{Password: }); after you type the required password, press
606 @key{RET} to submit it. To prevent others from seeing your password,
607 every character you type is displayed as a dot (@samp{.}) instead of
608 its usual form.
609
610 Most of the features and commands associated with the minibuffer can
611 @emph{not} be used when entering a password. There is no history or
612 completion, and you cannot change windows or perform any other action
613 with Emacs until you have submitted the password.
614
615 While you are typing the password, you may press @key{DEL} to delete
616 backwards, removing the last character entered. @key{C-u} deletes
617 everything you have typed so far. @kbd{C-g} quits the password prompt
618 (@pxref{Quitting}). @kbd{C-y} inserts the current kill into the
619 password (@pxref{Killing}). You may type either @key{RET} or
620 @key{ESC} to submit the password. Any other self-inserting character
621 key inserts the associated character into the password, and all other
622 input is ignored.
623
624 @ignore
625 arch-tag: ba913cfd-b70e-400f-b663-22b2c309227f
626 @end ignore