annotate man/mini.texi @ 82148:d979cb10446a

(calendar-scroll-left, calendar-scroll-right, calendar-scroll-left-three-months) (calendar-scroll-right-three-months): Clean up namespace. (scroll-calendar-left, scroll-calendar-right, scroll-calendar-left-three-months) (scroll-calendar-right-three-months): Add compatibility aliases.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 27 Jul 2007 06:13:26 +0000
parents 3d45362f1d38
children 02b9a9aa5b0c 95d0cdf160ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
1 @c This is part of the Emacs manual.
64890
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64375
diff changeset
2 @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001,
75348
3d45362f1d38 Add 2007 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 71751
diff changeset
3 @c 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
4 @c See file emacs.texi for copying conditions.
Dave Love <fx@gnu.org>
parents:
diff changeset
5 @node Minibuffer, M-x, Basic, Top
Dave Love <fx@gnu.org>
parents:
diff changeset
6 @chapter The Minibuffer
Dave Love <fx@gnu.org>
parents:
diff changeset
7 @cindex minibuffer
Dave Love <fx@gnu.org>
parents:
diff changeset
8
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
9 The @dfn{minibuffer} is where Emacs commands read complicated
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
10 arguments (anything more a single number). We call it the
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
11 ``minibuffer'' because it's a special-purpose buffer with a small
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
12 amount of screen space. Minibuffer arguments can be file names,
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
13 buffer names, Lisp function names, Emacs command names, Lisp
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
14 expressions, and many other things---whatever the command wants to
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
15 read. You can use the usual Emacs editing commands in the minibuffer
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
16 to edit the argument text.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
17
Dave Love <fx@gnu.org>
parents:
diff changeset
18 @cindex prompt
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
19 When the minibuffer is in use, it appears in the echo area, with a
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
20 cursor. The minibuffer display starts with a @dfn{prompt} in a
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
21 distinct color; it says what kind of input is expected and how it will
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
22 be used. Often the prompt is derived from the name of the command
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
23 that is reading the argument. The prompt normally ends with a colon.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
24
Dave Love <fx@gnu.org>
parents:
diff changeset
25 @cindex default argument
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
26 Sometimes a @dfn{default argument} appears in the prompt, inside
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
27 parentheses before the colon. The default will be used as the
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
28 argument value if you just type @key{RET}. For example, commands that
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
29 read buffer names show a buffer name as the default. You can type
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
30 @key{RET} to operate on that default buffer.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
31
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
32 The simplest way to enter a minibuffer argument is to type the text,
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
33 then @key{RET} to exit the minibuffer. You can cancel the minibuffer,
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
34 and the command that wants the argument, by typing @kbd{C-g}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
35
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
36 Since the minibuffer appears in the echo area, it can conflict with
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
37 other uses of the echo area. Here is how Emacs handles such
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
38 conflicts:
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
39
Dave Love <fx@gnu.org>
parents:
diff changeset
40 @itemize @bullet
Dave Love <fx@gnu.org>
parents:
diff changeset
41 @item
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
42 An error occurs while the minibuffer is active.
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
43
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
44 The error message hides the minibuffer for a few seconds, or until you
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
45 type something. Then the minibuffer comes back.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
46
Dave Love <fx@gnu.org>
parents:
diff changeset
47 @item
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
48 A command such as @kbd{C-x =} needs to display a message in the echo
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
49 area.
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
50
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
51 The message hides the minibuffer for a few seconds, or until you type
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
52 something. Then the minibuffer comes back.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
53
Dave Love <fx@gnu.org>
parents:
diff changeset
54 @item
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
55 Keystrokes don't echo while the minibuffer is in use.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
56 @end itemize
Dave Love <fx@gnu.org>
parents:
diff changeset
57
Dave Love <fx@gnu.org>
parents:
diff changeset
58 @menu
Dave Love <fx@gnu.org>
parents:
diff changeset
59 * File: Minibuffer File. Entering file names with the minibuffer.
Dave Love <fx@gnu.org>
parents:
diff changeset
60 * Edit: Minibuffer Edit. How to edit in the minibuffer.
Dave Love <fx@gnu.org>
parents:
diff changeset
61 * Completion:: An abbreviation facility for minibuffer input.
Dave Love <fx@gnu.org>
parents:
diff changeset
62 * Minibuffer History:: Reusing recent minibuffer arguments.
Dave Love <fx@gnu.org>
parents:
diff changeset
63 * Repetition:: Re-executing commands that used the minibuffer.
Dave Love <fx@gnu.org>
parents:
diff changeset
64 @end menu
Dave Love <fx@gnu.org>
parents:
diff changeset
65
Dave Love <fx@gnu.org>
parents:
diff changeset
66 @node Minibuffer File
Dave Love <fx@gnu.org>
parents:
diff changeset
67 @section Minibuffers for File Names
Dave Love <fx@gnu.org>
parents:
diff changeset
68
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
69 When you use the minibuffer to enter a file name, it starts out with
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
70 some initial text---the @dfn{default directory}, ending in a slash.
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
71 The file you specify will be in this directory unless you alter or
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
72 replace it.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
73
39265
523edbd58655 Spelling correction.
Richard M. Stallman <rms@gnu.org>
parents: 38870
diff changeset
74 @c Separate paragraph to clean up ugly page break--rms
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
75 @need 1500
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
76 For example, if the minibuffer starts out with these contents:
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
77
Dave Love <fx@gnu.org>
parents:
diff changeset
78 @example
Dave Love <fx@gnu.org>
parents:
diff changeset
79 Find File: /u2/emacs/src/
Dave Love <fx@gnu.org>
parents:
diff changeset
80 @end example
Dave Love <fx@gnu.org>
parents:
diff changeset
81
Dave Love <fx@gnu.org>
parents:
diff changeset
82 @noindent
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
83 (where @samp{Find File:@: } is the prompt), and you type
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
84 @kbd{buffer.c} as input, that specifies the file
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
85 @file{/u2/emacs/src/buffer.c}. You can specify the parent directory
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
86 by adding @file{..}; thus, if you type @kbd{../lisp/simple.el}, you
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
87 will get @file{/u2/emacs/lisp/simple.el}. Alternatively, you can use
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
88 @kbd{M-@key{DEL}} to kill the directory names you don't want
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
89 (@pxref{Words}).
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
90
71494
37c66dd77b79 (Minibuffer File): Minor cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 71207
diff changeset
91 You can kill the entire default with @kbd{C-a C-k}, but there's no
37c66dd77b79 (Minibuffer File): Minor cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 71207
diff changeset
92 need to do that. It's easier to ignore the default, and enter an
37c66dd77b79 (Minibuffer File): Minor cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 71207
diff changeset
93 absolute file name starting with a slash or a tilde after the default
37c66dd77b79 (Minibuffer File): Minor cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 71207
diff changeset
94 directory. For example, to specify @file{/etc/termcap}, just type
37c66dd77b79 (Minibuffer File): Minor cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 71207
diff changeset
95 that name:
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
96
Dave Love <fx@gnu.org>
parents:
diff changeset
97 @example
Dave Love <fx@gnu.org>
parents:
diff changeset
98 Find File: /u2/emacs/src//etc/termcap
Dave Love <fx@gnu.org>
parents:
diff changeset
99 @end example
Dave Love <fx@gnu.org>
parents:
diff changeset
100
Dave Love <fx@gnu.org>
parents:
diff changeset
101 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
102 @cindex // in file name
Dave Love <fx@gnu.org>
parents:
diff changeset
103 @cindex double slash in file name
Dave Love <fx@gnu.org>
parents:
diff changeset
104 @cindex slashes repeated in file name
66991
83e12e37521d (Minibuffer File): Clarify previous change. Add @findex.
Richard M. Stallman <rms@gnu.org>
parents: 66953
diff changeset
105 @findex file-name-shadow-mode
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
106 GNU Emacs interprets a double slash (which is not normally useful in
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
107 file names) as, ``ignore everything before the second slash in the
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
108 pair.'' In the example above. @samp{/u2/emacs/src/} is ignored, so
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
109 you get @file{/etc/termcap}. The ignored part of the file name is
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
110 dimmed if the terminal allows it; to disable this dimming, turn off
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
111 File Name Shadow mode (a minor mode) with the command
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
112 @kbd{M-x file-name-shadow-mode}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
113
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
114 If the variable @code{insert-default-directory} is @code{nil}, the
68458
eab2da67a471 Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 67395
diff changeset
115 default directory is never inserted in the minibuffer---so the
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
116 minibuffer starts out empty. Nonetheless, relative file name
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
117 arguments are still interpreted based on the same default directory.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
118
Dave Love <fx@gnu.org>
parents:
diff changeset
119 @node Minibuffer Edit
Dave Love <fx@gnu.org>
parents:
diff changeset
120 @section Editing in the Minibuffer
Dave Love <fx@gnu.org>
parents:
diff changeset
121
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
122 The minibuffer is an Emacs buffer (albeit a peculiar one), and the
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
123 usual Emacs commands are available for editing the argument text.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
124
Dave Love <fx@gnu.org>
parents:
diff changeset
125 Since @key{RET} in the minibuffer is defined to exit the minibuffer,
Dave Love <fx@gnu.org>
parents:
diff changeset
126 you can't use it to insert a newline in the minibuffer. To do that,
68458
eab2da67a471 Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 67395
diff changeset
127 type @kbd{C-o} or @kbd{C-q C-j}. (The newline character is really the
eab2da67a471 Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 67395
diff changeset
128 @acronym{ASCII} character control-J.)
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
129
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
130 The minibuffer has its own window, which normally has space in the
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
131 frame at all times, but it only acts like an Emacs window when the
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
132 minibuffer is active. When active, this window is much like any other
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
133 Emacs window; for instance, you can switch to another window (with
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
134 @kbd{C-x o}), edit text there, then return to the minibuffer window to
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
135 finish the argument. You can even kill text in another window, return
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
136 to the minibuffer window, and then yank the text into the argument.
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
137 @xref{Windows}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
138
Dave Love <fx@gnu.org>
parents:
diff changeset
139 @cindex height of minibuffer
Dave Love <fx@gnu.org>
parents:
diff changeset
140 @cindex size of minibuffer
Dave Love <fx@gnu.org>
parents:
diff changeset
141 @cindex growing minibuffer
27216
99ca9ac9c31a Minibuffer resizing now automatic.
Dave Love <fx@gnu.org>
parents: 25829
diff changeset
142 @cindex resizing minibuffer
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
143 There are some restrictions on the minibuffer window, however: you
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
144 cannot kill it, or split it, or switch buffers in it---the minibuffer
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
145 and its window are permanently attached.
33310
7476be16909f (Minibuffer Edit): Add description of
Gerd Moellmann <gerd@gnu.org>
parents: 31050
diff changeset
146
7476be16909f (Minibuffer Edit): Add description of
Gerd Moellmann <gerd@gnu.org>
parents: 31050
diff changeset
147 @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
148 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
149 text that you put in the minibuffer. If @code{resize-mini-windows} is
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
150 @code{t} (the default), the window always resizes as needed by its
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
151 contents. If its value is the symbol @code{grow-only}, the window
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
152 grows automatically as needed, but shrinks (back to the normal size)
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
153 only when the minibuffer becomes inactive. If its value is
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
154 @code{nil}, you have to adjust the height yourself.
33310
7476be16909f (Minibuffer Edit): Add description of
Gerd Moellmann <gerd@gnu.org>
parents: 31050
diff changeset
155
7476be16909f (Minibuffer Edit): Add description of
Gerd Moellmann <gerd@gnu.org>
parents: 31050
diff changeset
156 @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
157 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
158 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
159 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
160 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
161 window automatically. The default value is 0.25.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
162
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
163 The @kbd{C-M-v} command in the minibuffer scrolls the help text from
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
164 commands that display help text of any sort in another window.
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
165 @kbd{M-@key{PAGEUP}} and @kbd{M-@key{PAGEDOWN}} also operate on that
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
166 help text. This is especially useful with long lists of possible
60245
78a1812a9fd5 (Minibuffer): Prompts are highlighted.
Richard M. Stallman <rms@gnu.org>
parents: 59798
diff changeset
167 completions. @xref{Other Window}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
168
Dave Love <fx@gnu.org>
parents:
diff changeset
169 @vindex enable-recursive-minibuffers
Dave Love <fx@gnu.org>
parents:
diff changeset
170 Emacs normally disallows most commands that use the minibuffer while
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
171 the minibuffer is active. (Entering the minibuffer from the
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
172 minibuffer can be confusing.) To allow such commands in the
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
173 minibuffer, set the variable @code{enable-recursive-minibuffers} to
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
174 @code{t}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
175
Dave Love <fx@gnu.org>
parents:
diff changeset
176 @node Completion
Dave Love <fx@gnu.org>
parents:
diff changeset
177 @section Completion
Dave Love <fx@gnu.org>
parents:
diff changeset
178 @cindex completion
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
179
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
180 Some arguments allow @dfn{completion} to enter their value. This
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
181 means that after you type part of the argument, Emacs can fill in the
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
182 rest, or some of it, based on what you have typed so far.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
183
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
184 When completion is available, certain keys---@key{TAB}, @key{RET},
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
185 and @key{SPC}---are rebound to complete the text in the minibuffer
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
186 before point into a longer string chosen from a set of @dfn{completion
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
187 alternatives} provided by the command that requested the argument.
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
188 (@key{SPC} does not do completion in reading file names, because it is
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
189 common to use spaces in file names on some systems.) @kbd{?} displays
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
190 a list of the possible completions at any time.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
191
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
192 For example, @kbd{M-x} uses the minibuffer to read the name of a
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
193 command, so it provides a list of all Emacs command names for
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
194 completion candidates. The completion keys match the minibuffer text
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
195 against these candidates, find any additional name characters implied
71751
bf3a186a50a6 Fix typos.
Nick Roberts <nickrob@snap.net.nz>
parents: 71494
diff changeset
196 by the text already present in the minibuffer, and add those
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
197 characters. This makes it possible to type @kbd{M-x ins @key{SPC} b
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
198 @key{RET}} instead of @kbd{M-x insert-buffer @key{RET}}, for example.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
199
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
200 Case is significant in completion when it is significant in the
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
201 argument you are entering (buffer names, file names, command names,
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
202 for instance). Thus, @samp{fo} does not complete to @samp{Foo}.
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
203 Completion ignores case distinctions for certain arguments in which
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
204 case does not matter.
Dave Love <fx@gnu.org>
parents:
diff changeset
205
60798
e6d77fce1453 (Completion): Completion acts on text before point.
Richard M. Stallman <rms@gnu.org>
parents: 60473
diff changeset
206 Completion acts only on the text before point. If there is text in
e6d77fce1453 (Completion): Completion acts on text before point.
Richard M. Stallman <rms@gnu.org>
parents: 60473
diff changeset
207 the minibuffer after point---i.e., if you move point backward after
e6d77fce1453 (Completion): Completion acts on text before point.
Richard M. Stallman <rms@gnu.org>
parents: 60473
diff changeset
208 typing some text into the minibuffer---it remains unchanged.
e6d77fce1453 (Completion): Completion acts on text before point.
Richard M. Stallman <rms@gnu.org>
parents: 60473
diff changeset
209
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
210 @menu
54474
3264fbd6f6f5 (Completion): Add description for menu items.
Juri Linkov <juri@jurta.org>
parents: 52401
diff changeset
211 * Example: Completion Example. Examples of using completion.
3264fbd6f6f5 (Completion): Add description for menu items.
Juri Linkov <juri@jurta.org>
parents: 52401
diff changeset
212 * Commands: Completion Commands. A list of completion commands.
3264fbd6f6f5 (Completion): Add description for menu items.
Juri Linkov <juri@jurta.org>
parents: 52401
diff changeset
213 * Strict Completion:: Different types of completion.
3264fbd6f6f5 (Completion): Add description for menu items.
Juri Linkov <juri@jurta.org>
parents: 52401
diff changeset
214 * Options: Completion Options. Options for completion.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
215 @end menu
Dave Love <fx@gnu.org>
parents:
diff changeset
216
Dave Love <fx@gnu.org>
parents:
diff changeset
217 @node Completion Example
Dave Love <fx@gnu.org>
parents:
diff changeset
218 @subsection Completion Example
Dave Love <fx@gnu.org>
parents:
diff changeset
219
Dave Love <fx@gnu.org>
parents:
diff changeset
220 @kindex TAB @r{(completion)}
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
221 A concrete example may help here. If you type @kbd{M-x au
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
222 @key{TAB}}, the @key{TAB} looks for alternatives (in this case,
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
223 command names) that start with @samp{au}. There are several,
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
224 including @code{auto-fill-mode} and @code{auto-save-mode}, but they
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
225 all begin with @code{auto-}, so the @samp{au} in the minibuffer
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
226 completes to @samp{auto-}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
227
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
228 If you type @key{TAB} again immediately, it cannot determine the
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
229 next character; it could be any of @samp{cfilrs}. So it does not add
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
230 any characters; instead, @key{TAB} displays a list of all possible
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
231 completions in another window.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
232
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
233 Now type @kbd{f @key{TAB}}. This @key{TAB} sees @samp{auto-f}. The
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
234 only command name starting with that is @code{auto-fill-mode}, so
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
235 completion fills in the rest of that. You have been able to enter
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
236 @samp{auto-fill-mode} by typing just @kbd{au @key{TAB} f @key{TAB}}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
237
Dave Love <fx@gnu.org>
parents:
diff changeset
238 @node Completion Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
239 @subsection Completion Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
240
Dave Love <fx@gnu.org>
parents:
diff changeset
241 Here is a list of the completion commands defined in the minibuffer
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
242 when completion is allowed.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
243
Dave Love <fx@gnu.org>
parents:
diff changeset
244 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
245 @item @key{TAB}
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
246 @findex minibuffer-complete
46038
3d861934169e Completion operates on text before point.
Richard M. Stallman <rms@gnu.org>
parents: 44373
diff changeset
247 Complete the text before point in the minibuffer as much as possible
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
248 (@code{minibuffer-complete}).
Dave Love <fx@gnu.org>
parents:
diff changeset
249 @item @key{SPC}
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
250 Complete up to one word from the minibuffer text before point
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
251 (@code{minibuffer-complete-word}). @key{SPC} for completion is not
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
252 available when entering a file name, since file names often include
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
253 spaces.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
254 @item @key{RET}
Dave Love <fx@gnu.org>
parents:
diff changeset
255 Submit the text in the minibuffer as the argument, possibly completing
62333
80f8fd5fdea6 (Completion Commands): Correct reference.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60798
diff changeset
256 first as described
80f8fd5fdea6 (Completion Commands): Correct reference.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60798
diff changeset
257 @iftex
80f8fd5fdea6 (Completion Commands): Correct reference.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60798
diff changeset
258 in the next subsection (@code{minibuffer-complete-and-exit}).
80f8fd5fdea6 (Completion Commands): Correct reference.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60798
diff changeset
259 @end iftex
80f8fd5fdea6 (Completion Commands): Correct reference.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60798
diff changeset
260 @ifnottex
80f8fd5fdea6 (Completion Commands): Correct reference.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60798
diff changeset
261 in the next node (@code{minibuffer-complete-and-exit}). @xref{Strict
80f8fd5fdea6 (Completion Commands): Correct reference.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60798
diff changeset
262 Completion}.
80f8fd5fdea6 (Completion Commands): Correct reference.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60798
diff changeset
263 @end ifnottex
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
264 @item ?
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
265 Display a list of possible completions of the text before point
64375
32f868f94f5a (Completion Commands): Fix command name for ?.
Richard M. Stallman <rms@gnu.org>
parents: 62333
diff changeset
266 (@code{minibuffer-completion-help}).
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
267 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
268
Dave Love <fx@gnu.org>
parents:
diff changeset
269 @kindex SPC
Dave Love <fx@gnu.org>
parents:
diff changeset
270 @findex minibuffer-complete-word
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
271 @key{SPC} completes like @key{TAB}, but only up to the next hyphen
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
272 or space. If you have @samp{auto-f} in the minibuffer and type
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
273 @key{SPC}, it finds that the completion is @samp{auto-fill-mode}, but
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
274 it only inserts @samp{ill-}, giving @samp{auto-fill-}. Another
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
275 @key{SPC} at this point completes all the way to
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
276 @samp{auto-fill-mode}. The command that implements this behavior is
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
277 called @code{minibuffer-complete-word}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
278
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
279 When you display a list of possible completions, you can choose
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
280 one from it:
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
281
Dave Love <fx@gnu.org>
parents:
diff changeset
282 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
283 @findex mouse-choose-completion
60245
78a1812a9fd5 (Minibuffer): Prompts are highlighted.
Richard M. Stallman <rms@gnu.org>
parents: 59798
diff changeset
284 @item Mouse-1
78a1812a9fd5 (Minibuffer): Prompts are highlighted.
Richard M. Stallman <rms@gnu.org>
parents: 59798
diff changeset
285 @itemx Mouse-2
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
286 Clicking mouse button 1 or 2 on a completion possibility chooses that
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
287 completion (@code{mouse-choose-completion}). You must click in the
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
288 list of completions, not in the minibuffer.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
289
Dave Love <fx@gnu.org>
parents:
diff changeset
290 @findex switch-to-completions
Dave Love <fx@gnu.org>
parents:
diff changeset
291 @item @key{PRIOR}
Dave Love <fx@gnu.org>
parents:
diff changeset
292 @itemx M-v
Dave Love <fx@gnu.org>
parents:
diff changeset
293 Typing @key{PRIOR} or @key{PAGE-UP}, or @kbd{M-v}, while in the
Dave Love <fx@gnu.org>
parents:
diff changeset
294 minibuffer, selects the window showing the completion list buffer
Dave Love <fx@gnu.org>
parents:
diff changeset
295 (@code{switch-to-completions}). This paves the way for using the
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
296 commands below. (Selecting that window in other ways has the same
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
297 effect.)
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
298
Dave Love <fx@gnu.org>
parents:
diff changeset
299 @findex choose-completion
Dave Love <fx@gnu.org>
parents:
diff changeset
300 @item @key{RET}
Dave Love <fx@gnu.org>
parents:
diff changeset
301 Typing @key{RET} @emph{in the completion list buffer} chooses the
Dave Love <fx@gnu.org>
parents:
diff changeset
302 completion that point is in or next to (@code{choose-completion}). To
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
303 use this command, you must first switch to the completion list window.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
304
Dave Love <fx@gnu.org>
parents:
diff changeset
305 @findex next-completion
Dave Love <fx@gnu.org>
parents:
diff changeset
306 @item @key{RIGHT}
Dave Love <fx@gnu.org>
parents:
diff changeset
307 Typing the right-arrow key @key{RIGHT} @emph{in the completion list
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
308 buffer} moves point to the following completion possibility
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
309 (@code{next-completion}).
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
310
Dave Love <fx@gnu.org>
parents:
diff changeset
311 @findex previous-completion
Dave Love <fx@gnu.org>
parents:
diff changeset
312 @item @key{LEFT}
Dave Love <fx@gnu.org>
parents:
diff changeset
313 Typing the left-arrow key @key{LEFT} @emph{in the completion list
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
314 buffer} moves point to the previous completion possibility
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
315 (@code{previous-completion}).
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
316 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
317
Dave Love <fx@gnu.org>
parents:
diff changeset
318 @node Strict Completion
Dave Love <fx@gnu.org>
parents:
diff changeset
319 @subsection Strict Completion
Dave Love <fx@gnu.org>
parents:
diff changeset
320
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
321 There are three different ways that @key{RET} can do completion,
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
322 depending on how the argument will be used.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
323
Dave Love <fx@gnu.org>
parents:
diff changeset
324 @itemize @bullet
Dave Love <fx@gnu.org>
parents:
diff changeset
325 @item
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
326 @dfn{Strict} completion accepts only known completion candidates. For
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
327 example, when @kbd{C-x k} reads the name of a buffer to kill, only the
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
328 name of an existing buffer makes sense. In strict completion,
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
329 @key{RET} refuses to exit if the text in the minibuffer does not
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
330 complete to an exact match.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
331
Dave Love <fx@gnu.org>
parents:
diff changeset
332 @item
Dave Love <fx@gnu.org>
parents:
diff changeset
333 @dfn{Cautious} completion is similar to strict completion, except that
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
334 @key{RET} exits only if the text is an already exact match.
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
335 Otherwise, @key{RET} does not exit, but it does complete the text. If
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
336 that completes to an exact match, a second @key{RET} will exit.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
337
Dave Love <fx@gnu.org>
parents:
diff changeset
338 Cautious completion is used for reading file names for files that must
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
339 already exist, for example.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
340
Dave Love <fx@gnu.org>
parents:
diff changeset
341 @item
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
342 @dfn{Permissive} completion allows any input; the completion
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
343 candidates are just suggestions. For example, when @kbd{C-x C-f}
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
344 reads the name of a file to visit, any file name is allowed, including
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
345 nonexistent file (in case you want to create a file). In permissive
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
346 completion, @key{RET} does not complete, it just submits the argument
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
347 as you have entered it.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
348 @end itemize
Dave Love <fx@gnu.org>
parents:
diff changeset
349
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
350 The completion commands display a list of all possible completions
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
351 whenever they can't determine even one more character by completion.
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
352 Also, typing @kbd{?} explicitly requests such a list. You can scroll
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
353 the list with @kbd{C-M-v} (@pxref{Other Window}).
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
354
Dave Love <fx@gnu.org>
parents:
diff changeset
355 @node Completion Options
Dave Love <fx@gnu.org>
parents:
diff changeset
356 @subsection Completion Options
Dave Love <fx@gnu.org>
parents:
diff changeset
357
Dave Love <fx@gnu.org>
parents:
diff changeset
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
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
360 When completing file names, certain file names are usually ignored.
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
361 The variable @code{completion-ignored-extensions} contains a list of
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
362 strings; a file name ending in any of those strings is ignored as a
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
363 completion candidate. The standard value of this variable has several
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
364 elements including @code{".o"}, @code{".elc"}, @code{".dvi"} and
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
365 @code{"~"}. The effect is that, for example, @samp{foo} can complete
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
366 to @samp{foo.c} even though @samp{foo.o} exists as well. However, if
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
367 @emph{all} the possible completions end in ``ignored'' strings, then
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
368 they are not ignored. Displaying a list of possible completions
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
369 disregards @code{completion-ignored-extensions}; it shows them all.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
370
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
371 If an element of @code{completion-ignored-extensions} ends in a
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
372 slash (@file{/}), it's a subdirectory name; then that directory and
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
373 its contents are ignored. Elements of
39880
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
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
375 ordinary file names, and do not apply to names of directories.
39880
de2f745df406 (Completion Options): Document the significance of a trailing slash
Eli Zaretskii <eliz@gnu.org>
parents: 39265
diff changeset
376
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
377 @vindex completion-auto-help
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
378 If @code{completion-auto-help} is set to @code{nil}, the completion
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
379 commands never display a list of possibilities; you must type @kbd{?}
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
380 to display the list.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
381
28129
25e19c5c91f8 More on partial completion.
Dave Love <fx@gnu.org>
parents: 27216
diff changeset
382 @cindex Partial Completion mode
25e19c5c91f8 More on partial completion.
Dave Love <fx@gnu.org>
parents: 27216
diff changeset
383 @vindex partial-completion-mode
25e19c5c91f8 More on partial completion.
Dave Love <fx@gnu.org>
parents: 27216
diff changeset
384 @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
385 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
386 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
387 it can complete the command name abbreviation @code{p-b} into
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
388 @code{print-buffer} if no other command starts with two words whose
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
389 initials are @samp{p} and @samp{b}.
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
390
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
391 To enable this mode, use @kbd{M-x partial-completion-mode}, or
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
392 customize the variable @code{partial-completion-mode}. This mode
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
393 binds special partial completion commands to @key{TAB}, @key{SPC},
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
394 @key{RET}, and @kbd{?} in the minibuffer. The usual completion
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
395 commands are available on @kbd{M-@key{TAB}} (or @kbd{C-M-i}),
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
396 @kbd{M-@key{SPC}}, @kbd{M-@key{RET}} and @kbd{M-?}.
36166
7ce22edfb862 Clean up max-mini-window-height and Partial Completion mode.
Richard M. Stallman <rms@gnu.org>
parents: 33310
diff changeset
397
7ce22edfb862 Clean up max-mini-window-height and Partial Completion mode.
Richard M. Stallman <rms@gnu.org>
parents: 33310
diff changeset
398 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
399 indicate the places for completion; thus, @file{/u*/b*/f*} might
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
400 complete to @file{/usr/bin/foo}. For remote files, partial completion
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
401 enables completion of methods, user names and host names.
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
402 @xref{Remote Files}.
36166
7ce22edfb862 Clean up max-mini-window-height and Partial Completion mode.
Richard M. Stallman <rms@gnu.org>
parents: 33310
diff changeset
403
28129
25e19c5c91f8 More on partial completion.
Dave Love <fx@gnu.org>
parents: 27216
diff changeset
404 @vindex PC-include-file-path
25e19c5c91f8 More on partial completion.
Dave Love <fx@gnu.org>
parents: 27216
diff changeset
405 @vindex PC-disable-includes
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
406 Partial Completion mode also extends @code{find-file} so that
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
407 @samp{<@var{include}>} looks for the file named @var{include} in the
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
408 directories in the path @code{PC-include-file-path}. If you set
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
409 @code{PC-disable-includes} to non-@code{nil}, this feature is
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
410 disabled.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
411
Dave Love <fx@gnu.org>
parents:
diff changeset
412 @cindex Icomplete mode
28129
25e19c5c91f8 More on partial completion.
Dave Love <fx@gnu.org>
parents: 27216
diff changeset
413 @findex icomplete-mode
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
414 Icomplete mode presents a constantly-updated display that tells you
Dave Love <fx@gnu.org>
parents:
diff changeset
415 what completions are available for the text you've entered so far. The
Dave Love <fx@gnu.org>
parents:
diff changeset
416 command to enable or disable this minor mode is @kbd{M-x
Dave Love <fx@gnu.org>
parents:
diff changeset
417 icomplete-mode}.
Dave Love <fx@gnu.org>
parents:
diff changeset
418
Dave Love <fx@gnu.org>
parents:
diff changeset
419 @node Minibuffer History
Dave Love <fx@gnu.org>
parents:
diff changeset
420 @section Minibuffer History
Dave Love <fx@gnu.org>
parents:
diff changeset
421 @cindex minibuffer history
Dave Love <fx@gnu.org>
parents:
diff changeset
422 @cindex history of minibuffer input
Dave Love <fx@gnu.org>
parents:
diff changeset
423
Dave Love <fx@gnu.org>
parents:
diff changeset
424 Every argument that you enter with the minibuffer is saved on a
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
425 @dfn{minibuffer history list} so you can easily use it again later.
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
426 Special commands fetch the text of an earlier argument into the
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
427 minibuffer, replacing the old minibuffer contents. You can think of
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
428 them as moving through the history of previous arguments.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
429
Dave Love <fx@gnu.org>
parents:
diff changeset
430 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
431 @item @key{UP}
Dave Love <fx@gnu.org>
parents:
diff changeset
432 @itemx M-p
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
433 Move to the previous item in the minibuffer history, an earlier argument
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
434 (@code{previous-history-element}).
Dave Love <fx@gnu.org>
parents:
diff changeset
435 @item @key{DOWN}
Dave Love <fx@gnu.org>
parents:
diff changeset
436 @itemx M-n
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
437 Move to the next item in the minibuffer history
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
438 (@code{next-history-element}).
Dave Love <fx@gnu.org>
parents:
diff changeset
439 @item M-r @var{regexp} @key{RET}
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
440 Move to an earlier item in the minibuffer history that
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
441 matches @var{regexp} (@code{previous-matching-history-element}).
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
442 @item M-s @var{regexp} @key{RET}
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
443 Move to a later item in the minibuffer history that matches
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
444 @var{regexp} (@code{next-matching-history-element}).
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
445 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
446
Dave Love <fx@gnu.org>
parents:
diff changeset
447 @kindex M-p @r{(minibuffer history)}
Dave Love <fx@gnu.org>
parents:
diff changeset
448 @kindex M-n @r{(minibuffer history)}
Dave Love <fx@gnu.org>
parents:
diff changeset
449 @findex next-history-element
Dave Love <fx@gnu.org>
parents:
diff changeset
450 @findex previous-history-element
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
451 To move through the minibuffer history list one item at a time, use
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
452 @kbd{M-p} or up-arrow (@code{previous-history-element}) to fetch the
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
453 next earlier minibuffer input, and use @kbd{M-n} or down-arrow
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
454 (@code{next-history-element}) to fetch the next later input. These
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
455 commands don't move the cursor, they pull different saved strings into
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
456 the minibuffer. But you can think of them as ``moving'' through the
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
457 history list.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
458
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
459 The input that you fetch from the history entirely replaces the
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
460 contents of the minibuffer. To use it again unchanged, just type
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
461 @key{RET}. You can also edit the text before you reuse it; this does
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
462 not change the history element that you ``moved'' to, but your new
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
463 argument does go at the end of the history list in its own right.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
464
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
465 For many minibuffer arguments there is a ``default'' value. You can
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
466 insert the default value into the minibuffer as text by using
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
467 @kbd{M-n}. You can think of this as moving ``into the future'' in the
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
468 history.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
469
Dave Love <fx@gnu.org>
parents:
diff changeset
470 @findex previous-matching-history-element
Dave Love <fx@gnu.org>
parents:
diff changeset
471 @findex next-matching-history-element
Dave Love <fx@gnu.org>
parents:
diff changeset
472 @kindex M-r @r{(minibuffer history)}
Dave Love <fx@gnu.org>
parents:
diff changeset
473 @kindex M-s @r{(minibuffer history)}
Dave Love <fx@gnu.org>
parents:
diff changeset
474 There are also commands to search forward or backward through the
Dave Love <fx@gnu.org>
parents:
diff changeset
475 history; they search for history elements that match a regular
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
476 expression. @kbd{M-r} (@code{previous-matching-history-element})
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
477 searches older elements in the history, while @kbd{M-s}
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
478 (@code{next-matching-history-element}) searches newer elements. These
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
479 commands are unusual; they use the minibuffer to read the regular
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
480 expression even though they are invoked from the minibuffer. As with
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
481 incremental searching, an upper-case letter in the regular expression
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
482 makes the search case-sensitive (@pxref{Search Case}).
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
483
Dave Love <fx@gnu.org>
parents:
diff changeset
484 @ignore
Dave Love <fx@gnu.org>
parents:
diff changeset
485 We may change the precise way these commands read their arguments.
Dave Love <fx@gnu.org>
parents:
diff changeset
486 Perhaps they will search for a match for the string given so far in the
Dave Love <fx@gnu.org>
parents:
diff changeset
487 minibuffer; perhaps they will search for a literal match rather than a
Dave Love <fx@gnu.org>
parents:
diff changeset
488 regular expression match; perhaps they will only accept matches at the
Dave Love <fx@gnu.org>
parents:
diff changeset
489 beginning of a history element; perhaps they will read the string to
Dave Love <fx@gnu.org>
parents:
diff changeset
490 search for incrementally like @kbd{C-s}. To find out what interface is
Dave Love <fx@gnu.org>
parents:
diff changeset
491 actually available, type @kbd{C-h f previous-matching-history-element}.
Dave Love <fx@gnu.org>
parents:
diff changeset
492 @end ignore
Dave Love <fx@gnu.org>
parents:
diff changeset
493
Dave Love <fx@gnu.org>
parents:
diff changeset
494 All uses of the minibuffer record your input on a history list, but
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
495 there are separate history lists for different kinds of arguments.
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
496 For example, there is a list for file names, used by all the commands
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
497 that read file names. (As a special feature, this history list
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
498 records the absolute file name, even if the name you entered was not
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
499 absolute.)
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
500
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
501 There are several other specific history lists, including one for
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
502 buffer names, one for arguments of commands like @code{query-replace},
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
503 one used by @kbd{M-x} for command names, and one used by
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
504 @code{compile} for compilation commands. Finally, there is one
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
505 ``miscellaneous'' history list that most minibuffer arguments use.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
506
Dave Love <fx@gnu.org>
parents:
diff changeset
507 @vindex history-length
Dave Love <fx@gnu.org>
parents:
diff changeset
508 The variable @code{history-length} specifies the maximum length of a
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
509 minibuffer history list; adding a new element deletes the oldest
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
510 element if the list gets too long. If the value of
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
511 @code{history-length} is @code{t}, though, there is no maximum length.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
512
57017
9f99ae07c452 (Minibuffer History): Add `history-delete-duplicates'.
Juri Linkov <juri@jurta.org>
parents: 54474
diff changeset
513 @vindex history-delete-duplicates
9f99ae07c452 (Minibuffer History): Add `history-delete-duplicates'.
Juri Linkov <juri@jurta.org>
parents: 54474
diff changeset
514 The variable @code{history-delete-duplicates} specifies whether to
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
515 delete duplicates in history. If it is @code{t}, adding a new element
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
516 deletes from the list all other elements that are equal to it.
57017
9f99ae07c452 (Minibuffer History): Add `history-delete-duplicates'.
Juri Linkov <juri@jurta.org>
parents: 54474
diff changeset
517
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
518 @node Repetition
Dave Love <fx@gnu.org>
parents:
diff changeset
519 @section Repeating Minibuffer Commands
Dave Love <fx@gnu.org>
parents:
diff changeset
520 @cindex command history
Dave Love <fx@gnu.org>
parents:
diff changeset
521 @cindex history of commands
Dave Love <fx@gnu.org>
parents:
diff changeset
522
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
523 Every command that uses the minibuffer once is recorded on a special
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
524 history list, the @dfn{command history}, together with the values of
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
525 its arguments, so that you can repeat the entire command. In
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
526 particular, every use of @kbd{M-x} is recorded there, since @kbd{M-x}
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
527 uses the minibuffer to read the command name.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
528
Dave Love <fx@gnu.org>
parents:
diff changeset
529 @findex list-command-history
Dave Love <fx@gnu.org>
parents:
diff changeset
530 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
531 @item C-x @key{ESC} @key{ESC}
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
532 Re-execute a recent minibuffer command from the command history
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
533 (@code{repeat-complex-command}).
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
534 @item M-x list-command-history
Dave Love <fx@gnu.org>
parents:
diff changeset
535 Display the entire command history, showing all the commands
Dave Love <fx@gnu.org>
parents:
diff changeset
536 @kbd{C-x @key{ESC} @key{ESC}} can repeat, most recent first.
Dave Love <fx@gnu.org>
parents:
diff changeset
537 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
538
Dave Love <fx@gnu.org>
parents:
diff changeset
539 @kindex C-x ESC ESC
Dave Love <fx@gnu.org>
parents:
diff changeset
540 @findex repeat-complex-command
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
541 @kbd{C-x @key{ESC} @key{ESC}} is used to re-execute a recent command
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
542 that used the minibuffer. With no argument, it repeats the last such
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
543 command. A numeric argument specifies which command to repeat; 1
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
544 means the last one, 2 the previous, and so on.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
545
Dave Love <fx@gnu.org>
parents:
diff changeset
546 @kbd{C-x @key{ESC} @key{ESC}} works by turning the previous command
Dave Love <fx@gnu.org>
parents:
diff changeset
547 into a Lisp expression and then entering a minibuffer initialized with
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
548 the text for that expression. Even if you don't understand Lisp
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
549 syntax, it will probably be obvious which command is displayed for
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
550 repetition. If you type just @key{RET}, that repeats the command
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
551 unchanged. You can also change the command by editing the Lisp
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
552 expression before you execute it. The repeated command is added to
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
553 the front of the command history unless it is identical to the most
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
554 recently item.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
555
Dave Love <fx@gnu.org>
parents:
diff changeset
556 Once inside the minibuffer for @kbd{C-x @key{ESC} @key{ESC}}, you can
Dave Love <fx@gnu.org>
parents:
diff changeset
557 use the minibuffer history commands (@kbd{M-p}, @kbd{M-n}, @kbd{M-r},
Dave Love <fx@gnu.org>
parents:
diff changeset
558 @kbd{M-s}; @pxref{Minibuffer History}) to move through the history list
Dave Love <fx@gnu.org>
parents:
diff changeset
559 of saved entire commands. After finding the desired previous command,
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
560 you can edit its expression as usual and then repeat it by typing
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
561 @key{RET}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
562
57080
82fe8e8f2ffe (Repetition): Rename isearch-resume-enabled to
Kim F. Storm <storm@cua.dk>
parents: 57017
diff changeset
563 @vindex isearch-resume-in-command-history
71207
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
564 Incremental search does not, strictly speaking, use the minibuffer.
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
565 Therefore, although it behaves like a complex command, it normally
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
566 does not appear in the history list for @kbd{C-x @key{ESC} @key{ESC}}.
c550ef173e58 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 70487
diff changeset
567 You can make incremental search commands appear in the history by
57080
82fe8e8f2ffe (Repetition): Rename isearch-resume-enabled to
Kim F. Storm <storm@cua.dk>
parents: 57017
diff changeset
568 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
569 value. @xref{Incremental Search}.
46038
3d861934169e Completion operates on text before point.
Richard M. Stallman <rms@gnu.org>
parents: 44373
diff changeset
570
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
571 @vindex command-history
Dave Love <fx@gnu.org>
parents:
diff changeset
572 The list of previous minibuffer-using commands is stored as a Lisp
Dave Love <fx@gnu.org>
parents:
diff changeset
573 list in the variable @code{command-history}. Each element is a Lisp
Dave Love <fx@gnu.org>
parents:
diff changeset
574 expression which describes one command and its arguments. Lisp programs
Dave Love <fx@gnu.org>
parents:
diff changeset
575 can re-execute a command by calling @code{eval} with the
Dave Love <fx@gnu.org>
parents:
diff changeset
576 @code{command-history} element.
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 46038
diff changeset
577
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 46038
diff changeset
578 @ignore
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 46038
diff changeset
579 arch-tag: ba913cfd-b70e-400f-b663-22b2c309227f
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 46038
diff changeset
580 @end ignore