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