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