diff options
| author | Richard M. Stallman | 2006-06-04 02:17:49 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2006-06-04 02:17:49 +0000 |
| commit | 3c8c279cc1bbf28fdac7db14dc9e100d576a86cd (patch) | |
| tree | 2e25524ed0c8bc5d4d3e1fa012a3cfa8f120c509 | |
| parent | e38cc268e2d391191b6a81b9b72f4cd1491faafa (diff) | |
| download | emacs-3c8c279cc1bbf28fdac7db14dc9e100d576a86cd.tar.gz emacs-3c8c279cc1bbf28fdac7db14dc9e100d576a86cd.zip | |
Lots of cleanups.
| -rw-r--r-- | man/ChangeLog | 4 | ||||
| -rw-r--r-- | man/mini.texi | 608 |
2 files changed, 292 insertions, 320 deletions
diff --git a/man/ChangeLog b/man/ChangeLog index e4280d404d8..85c89fbe4d5 100644 --- a/man/ChangeLog +++ b/man/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2006-06-03 Ted Zlatanov <tzz@lifelogs.com> | ||
| 2 | |||
| 3 | * mini.texi: Lots of cleanups. | ||
| 4 | |||
| 1 | 2006-06-01 Luc Teirlinck <teirllm@auburn.edu> | 5 | 2006-06-01 Luc Teirlinck <teirllm@auburn.edu> |
| 2 | 6 | ||
| 3 | * misc.texi (Shell History Copying): Update descriptions of `C-c RET' | 7 | * misc.texi (Shell History Copying): Update descriptions of `C-c RET' |
diff --git a/man/mini.texi b/man/mini.texi index 4c3748a78f1..e0a851cfc9a 100644 --- a/man/mini.texi +++ b/man/mini.texi | |||
| @@ -6,55 +6,53 @@ | |||
| 6 | @chapter The Minibuffer | 6 | @chapter The Minibuffer |
| 7 | @cindex minibuffer | 7 | @cindex minibuffer |
| 8 | 8 | ||
| 9 | The @dfn{minibuffer} is the facility used by Emacs commands to read | 9 | The @dfn{minibuffer} is where Emacs commands read complicated |
| 10 | arguments more complicated than a single number. Minibuffer arguments | 10 | arguments (anything more a single number). We call it the |
| 11 | can be file names, buffer names, Lisp function names, Emacs command | 11 | ``minibuffer'' because it's a special-purpose buffer with a small |
| 12 | names, Lisp expressions, and many other things, depending on the command | 12 | amount of screen space. Minibuffer arguments can be file names, |
| 13 | reading the argument. You can use the usual Emacs editing commands in | 13 | buffer names, Lisp function names, Emacs command names, Lisp |
| 14 | the minibuffer to edit the argument text. | 14 | expressions, and many other things---whatever the command wants to |
| 15 | read. You can use the usual Emacs editing commands in the minibuffer | ||
| 16 | to edit the argument text. | ||
| 15 | 17 | ||
| 16 | @cindex prompt | 18 | @cindex prompt |
| 17 | When the minibuffer is in use, it appears in the echo area, and the | 19 | When the minibuffer is in use, it appears in the echo area, with a |
| 18 | terminal's cursor moves there. The beginning of the minibuffer line | 20 | cursor. The minibuffer display starts with a @dfn{prompt} in a |
| 19 | displays a @dfn{prompt} in a special color, to say what kind of input | 21 | distinct color; it says what kind of input is expected and how it will |
| 20 | you should supply and how it will be used. Often this prompt is | 22 | be used. Often the prompt is derived from the name of the command |
| 21 | derived from the name of the command that the argument is for. The | 23 | that is reading the argument. The prompt normally ends with a colon. |
| 22 | prompt normally ends with a colon. | ||
| 23 | 24 | ||
| 24 | @cindex default argument | 25 | @cindex default argument |
| 25 | Sometimes a @dfn{default argument} appears in parentheses before the | 26 | Sometimes a @dfn{default argument} appears in the prompt, inside |
| 26 | colon; it too is part of the prompt. The default will be used as the | 27 | parentheses before the colon. The default will be used as the |
| 27 | argument value if you enter an empty argument (that is, just type | 28 | argument value if you just type @key{RET}. For example, commands that |
| 28 | @key{RET}). For example, commands that read buffer names always show a | 29 | read buffer names show a buffer name as the default. You can type |
| 29 | default, which is the name of the buffer that will be used if you type | 30 | @key{RET} to operate on that default buffer. |
| 30 | just @key{RET}. | 31 | |
| 31 | 32 | The simplest way to enter a minibuffer argument is to type the text, | |
| 32 | The simplest way to enter a minibuffer argument is to type the text | 33 | then @key{RET} to exit the minibuffer. You can cancel the minibuffer, |
| 33 | you want, terminated by @key{RET} which exits the minibuffer. You can | 34 | and the command that wants the argument, by typing @kbd{C-g}. |
| 34 | cancel the command that wants the argument, and get out of the | 35 | |
| 35 | minibuffer, by typing @kbd{C-g}. | 36 | Since the minibuffer appears in the echo area, it can conflict with |
| 36 | 37 | other uses of the echo area. Here is how Emacs handles such | |
| 37 | Since the minibuffer uses the screen space of the echo area, it can | 38 | conflicts: |
| 38 | conflict with other ways Emacs customarily uses the echo area. Here is how | ||
| 39 | Emacs handles such conflicts: | ||
| 40 | 39 | ||
| 41 | @itemize @bullet | 40 | @itemize @bullet |
| 42 | @item | 41 | @item |
| 43 | If a command gets an error while you are in the minibuffer, this does | 42 | An error occurs while the minibuffer is active. |
| 44 | not cancel the minibuffer. However, the echo area is needed for the | 43 | |
| 45 | error message and therefore the minibuffer itself is hidden for a | 44 | The error message hides the minibuffer for a few seconds, or until you |
| 46 | while. It comes back after a few seconds, or as soon as you type | 45 | type something. Then the minibuffer comes back. |
| 47 | anything. | ||
| 48 | 46 | ||
| 49 | @item | 47 | @item |
| 50 | If in the minibuffer you use a command whose purpose is to display a | 48 | A command such as @kbd{C-x =} needs to display a message in the echo |
| 51 | message in the echo area, such as @kbd{C-x =}, the message hides the | 49 | area. |
| 52 | minibuffer for a while. The minibuffer contents come back after a few | 50 | |
| 53 | seconds, or as soon as you type anything. | 51 | The message hides the minibuffer for a few seconds, or until you type |
| 52 | something. Then the minibuffer comes back. | ||
| 54 | 53 | ||
| 55 | @item | 54 | @item |
| 56 | Echoing of keystrokes does not take place while the minibuffer is in | 55 | Keystrokes don't echo while the minibuffer is in use. |
| 57 | use. | ||
| 58 | @end itemize | 56 | @end itemize |
| 59 | 57 | ||
| 60 | @menu | 58 | @menu |
| @@ -68,34 +66,32 @@ use. | |||
| 68 | @node Minibuffer File | 66 | @node Minibuffer File |
| 69 | @section Minibuffers for File Names | 67 | @section Minibuffers for File Names |
| 70 | 68 | ||
| 71 | Sometimes the minibuffer starts out with text in it. For example, when | 69 | When you use the minibuffer to enter a file name, it starts out with |
| 72 | you are supposed to give a file name, the minibuffer starts out containing | 70 | some initial text---the @dfn{default directory}, ending in a slash. |
| 73 | the @dfn{default directory}, which ends with a slash. This is to inform | 71 | The file you specify will be in this directory unless you alter or |
| 74 | you which directory the file will be found in if you do not specify a | 72 | replace it. |
| 75 | directory. | ||
| 76 | 73 | ||
| 77 | @c Separate paragraph to clean up ugly page break--rms | 74 | @c Separate paragraph to clean up ugly page break--rms |
| 78 | @need 1500 | 75 | @need 1500 |
| 79 | For example, the minibuffer might start out with these contents: | 76 | For example, if the minibuffer starts out with these contents: |
| 80 | 77 | ||
| 81 | @example | 78 | @example |
| 82 | Find File: /u2/emacs/src/ | 79 | Find File: /u2/emacs/src/ |
| 83 | @end example | 80 | @end example |
| 84 | 81 | ||
| 85 | @noindent | 82 | @noindent |
| 86 | where @samp{Find File:@: } is the prompt. Typing @kbd{buffer.c} as | 83 | (where @samp{Find File:@: } is the prompt), and you type |
| 87 | input specifies the file @file{/u2/emacs/src/buffer.c}. To find files | 84 | @kbd{buffer.c} as input, that specifies the file |
| 88 | in nearby directories, use @kbd{..}; thus, if you type | 85 | @file{/u2/emacs/src/buffer.c}. You can specify the parent directory |
| 89 | @kbd{../lisp/simple.el}, you will get the file named | 86 | by adding @file{..}; thus, if you type @kbd{../lisp/simple.el}, you |
| 90 | @file{/u2/emacs/lisp/simple.el}. Alternatively, you can kill with | 87 | will get @file{/u2/emacs/lisp/simple.el}. Alternatively, you can use |
| 91 | @kbd{M-@key{DEL}} the directory names you don't want (@pxref{Words}). | 88 | @kbd{M-@key{DEL}} to kill the directory names you don't want |
| 92 | 89 | (@pxref{Words}). | |
| 93 | If you don't want any of the default, you can kill it with @kbd{C-a | 90 | |
| 94 | C-k}. But you don't need to kill the default; you can simply ignore it. | 91 | You can kill it the entire default with @kbd{C-a C-k}, but there's |
| 95 | Insert an absolute file name, one starting with a slash or a tilde, | 92 | no need. You can simply ignore it and give an absolute file name |
| 96 | after the default directory. For example, to specify the file | 93 | starting with a slash or a tilde after the default directory. For |
| 97 | @file{/etc/termcap}, just insert that name, giving these minibuffer | 94 | example, to specify @file{/etc/termcap}, just type that name: |
| 98 | contents: | ||
| 99 | 95 | ||
| 100 | @example | 96 | @example |
| 101 | Find File: /u2/emacs/src//etc/termcap | 97 | Find File: /u2/emacs/src//etc/termcap |
| @@ -106,59 +102,55 @@ Find File: /u2/emacs/src//etc/termcap | |||
| 106 | @cindex double slash in file name | 102 | @cindex double slash in file name |
| 107 | @cindex slashes repeated in file name | 103 | @cindex slashes repeated in file name |
| 108 | @findex file-name-shadow-mode | 104 | @findex file-name-shadow-mode |
| 109 | GNU Emacs gives a special meaning to a double slash (which is not | 105 | GNU Emacs interprets a double slash (which is not normally useful in |
| 110 | normally a useful thing to write): it means, ``ignore everything | 106 | file names) as, ``ignore everything before the second slash in the |
| 111 | before the second slash in the pair.'' Thus, @samp{/u2/emacs/src/} is | 107 | pair.'' In the example above. @samp{/u2/emacs/src/} is ignored, so |
| 112 | ignored in the example above, and you get the file | 108 | you get @file{/etc/termcap}. The ignored part of the file name is |
| 113 | @file{/etc/termcap}. The ignored part of the file name is dimmed if | 109 | dimmed if the terminal allows it; to disable this dimming, turn off |
| 114 | the terminal allows it; to disable this, turn off | 110 | File Name Shadow mode (a minor mode) with the command |
| 115 | @code{file-name-shadow-mode} minor mode. | 111 | @kbd{M-x file-name-shadow-mode}. |
| 116 | 112 | ||
| 117 | If you set @code{insert-default-directory} to @code{nil}, the | 113 | If the variable @code{insert-default-directory} is @code{nil}, the |
| 118 | default directory is never inserted in the minibuffer---so the | 114 | default directory is never inserted in the minibuffer---so the |
| 119 | minibuffer starts out empty. But the name you type, if relative, is | 115 | minibuffer starts out empty. Nonetheless, relative file name |
| 120 | still interpreted with respect to the same default directory. | 116 | arguments are still interpreted based on the same default directory. |
| 121 | 117 | ||
| 122 | @node Minibuffer Edit | 118 | @node Minibuffer Edit |
| 123 | @section Editing in the Minibuffer | 119 | @section Editing in the Minibuffer |
| 124 | 120 | ||
| 125 | The minibuffer is an Emacs buffer (albeit a peculiar one), and the usual | 121 | The minibuffer is an Emacs buffer (albeit a peculiar one), and the |
| 126 | Emacs commands are available for editing the text of an argument you are | 122 | usual Emacs commands are available for editing the argument text. |
| 127 | entering. | ||
| 128 | 123 | ||
| 129 | Since @key{RET} in the minibuffer is defined to exit the minibuffer, | 124 | Since @key{RET} in the minibuffer is defined to exit the minibuffer, |
| 130 | you can't use it to insert a newline in the minibuffer. To do that, | 125 | you can't use it to insert a newline in the minibuffer. To do that, |
| 131 | type @kbd{C-o} or @kbd{C-q C-j}. (The newline character is really the | 126 | type @kbd{C-o} or @kbd{C-q C-j}. (The newline character is really the |
| 132 | @acronym{ASCII} character control-J.) | 127 | @acronym{ASCII} character control-J.) |
| 133 | 128 | ||
| 134 | The minibuffer has its own window, which normally has space on the | 129 | The minibuffer has its own window, which normally has space in the |
| 135 | Emacs frame at all times, but it only acts like an Emacs window when | 130 | frame at all times, but it only acts like an Emacs window when the |
| 136 | the minibuffer is really in use. At those times, its window is much | 131 | minibuffer is active. When active, this window is much like any other |
| 137 | like any other Emacs window; you can switch from the minibuffer window | 132 | Emacs window; for instance, you can switch to another window (with |
| 138 | to another window with @kbd{C-x o}, and edit text in other windows, | 133 | @kbd{C-x o}), edit text there, then return to the minibuffer window to |
| 139 | before returning to the minibuffer to submit the argument. You can | 134 | finish the argument. You can even kill text in another window, return |
| 140 | kill text in another window, return to the minibuffer window, and then | 135 | to the minibuffer window, and then yank the text into the argument. |
| 141 | yank the text to use it in the argument. @xref{Windows}. | 136 | @xref{Windows}. |
| 142 | 137 | ||
| 143 | @cindex height of minibuffer | 138 | @cindex height of minibuffer |
| 144 | @cindex size of minibuffer | 139 | @cindex size of minibuffer |
| 145 | @cindex growing minibuffer | 140 | @cindex growing minibuffer |
| 146 | @cindex resizing minibuffer | 141 | @cindex resizing minibuffer |
| 147 | There are some restrictions on the use of the minibuffer window, | 142 | There are some restrictions on the minibuffer window, however: you |
| 148 | however. You cannot switch buffers in it---the minibuffer and its | 143 | cannot kill it, or split it, or switch buffers in it---the minibuffer |
| 149 | window are permanently attached. Also, you cannot split or kill the | 144 | and its window are permanently attached. |
| 150 | minibuffer window. But you can make it taller in the normal fashion | ||
| 151 | with @kbd{C-x ^}. | ||
| 152 | 145 | ||
| 153 | @vindex resize-mini-windows | 146 | @vindex resize-mini-windows |
| 154 | The minibuffer window expands vertically as necessary to hold the | 147 | The minibuffer window expands vertically as necessary to hold the |
| 155 | text that you put in the minibuffer. If @code{resize-mini-windows} is | 148 | text that you put in the minibuffer. If @code{resize-mini-windows} is |
| 156 | @code{t} (the default), the window is always resized to fit the size | 149 | @code{t} (the default), the window always resizes as needed by its |
| 157 | of the text it displays. If its value is the symbol @code{grow-only}, | 150 | contents. If its value is the symbol @code{grow-only}, the window |
| 158 | the window grows when the size of displayed text increases, but | 151 | grows automatically as needed, but shrinks (back to the normal size) |
| 159 | shrinks (back to the normal size) only when the minibuffer becomes | 152 | only when the minibuffer becomes inactive. If its value is |
| 160 | inactive. If its value is @code{nil}, you have to adjust the height | 153 | @code{nil}, you have to adjust the height yourself. |
| 161 | yourself. | ||
| 162 | 154 | ||
| 163 | @vindex max-mini-window-height | 155 | @vindex max-mini-window-height |
| 164 | The variable @code{max-mini-window-height} controls the maximum | 156 | The variable @code{max-mini-window-height} controls the maximum |
| @@ -167,52 +159,47 @@ specifies a fraction of the frame's height; an integer specifies the | |||
| 167 | maximum number of lines; @code{nil} means do not resize the minibuffer | 159 | maximum number of lines; @code{nil} means do not resize the minibuffer |
| 168 | window automatically. The default value is 0.25. | 160 | window automatically. The default value is 0.25. |
| 169 | 161 | ||
| 170 | If, while in the minibuffer, you issue a command that displays help | 162 | The @kbd{C-M-v} command in the minibuffer scrolls the help text from |
| 171 | text of any sort in another window, you can use the @kbd{C-M-v} | 163 | commands that display help text of any sort in another window. |
| 172 | command while in the minibuffer to scroll the help text. | 164 | @kbd{M-@key{PAGEUP}} and @kbd{M-@key{PAGEDOWN}} also operate on that |
| 173 | (@kbd{M-@key{PAGEUP}} and @kbd{M-@key{PAGEDOWN}} also operate on that | 165 | help text. This is especially useful with long lists of possible |
| 174 | help text.) This lasts until you exit the minibuffer. This feature | ||
| 175 | is especially useful when you display a buffer listing possible | ||
| 176 | completions. @xref{Other Window}. | 166 | completions. @xref{Other Window}. |
| 177 | 167 | ||
| 178 | @vindex enable-recursive-minibuffers | 168 | @vindex enable-recursive-minibuffers |
| 179 | Emacs normally disallows most commands that use the minibuffer while | 169 | Emacs normally disallows most commands that use the minibuffer while |
| 180 | the minibuffer is active. This rule is to prevent recursive minibuffers | 170 | the minibuffer is active. (Entering the minibuffer from the |
| 181 | from confusing novice users. If you want to be able to use such | 171 | minibuffer can be confusing.) To allow such commands in the |
| 182 | commands in the minibuffer, set the variable | 172 | minibuffer, set the variable @code{enable-recursive-minibuffers} to |
| 183 | @code{enable-recursive-minibuffers} to a non-@code{nil} value. | 173 | @code{t}. |
| 184 | 174 | ||
| 185 | @node Completion | 175 | @node Completion |
| 186 | @section Completion | 176 | @section Completion |
| 187 | @cindex completion | 177 | @cindex completion |
| 188 | 178 | ||
| 189 | For certain kinds of arguments, you can use @dfn{completion} to enter | 179 | Some arguments allow @dfn{completion} to enter their value. This |
| 190 | the argument value. Completion means that you type part of the | 180 | means that after you type part of the argument, Emacs can fill in the |
| 191 | argument, then Emacs visibly fills in the rest, or as much as | 181 | rest, or some of it, based on what you have typed so far. |
| 192 | can be determined from the part you have typed. | 182 | |
| 193 | 183 | When completion is available, certain keys---@key{TAB}, @key{RET}, | |
| 194 | When completion is available, certain keys---@key{TAB}, @key{RET}, and | 184 | and @key{SPC}---are rebound to complete the text in the minibuffer |
| 195 | @key{SPC}---are rebound to complete the text in the minibuffer before point | 185 | before point into a longer string chosen from a set of @dfn{completion |
| 196 | into a longer string that it stands for, by matching it against a set of | 186 | alternatives} provided by the command that requested the argument. |
| 197 | @dfn{completion alternatives} provided by the command reading the | 187 | (@key{SPC} does not do completion in reading file names, because it is |
| 198 | argument. @kbd{?} is defined to display a list of possible completions | 188 | common to use spaces in file names on some systems.) @kbd{?} displays |
| 199 | of what you have inserted. | 189 | a list of the possible completions at any time. |
| 200 | 190 | ||
| 201 | For example, when @kbd{M-x} uses the minibuffer to read the name of | 191 | For example, @kbd{M-x} uses the minibuffer to read the name of a |
| 202 | a command, it provides a list of all available Emacs command names to | 192 | command, so it provides a list of all Emacs command names for |
| 203 | complete against. The completion keys match the minibuffer text | 193 | completion candidates. The completion keys match the minibuffer text |
| 204 | against all the command names, find any additional name characters | 194 | against these candidates, find any additional name characters implied |
| 205 | implied by the ones already present in the minibuffer, and add those | 195 | by the the text already present in the minibuffer, and add those |
| 206 | characters to the ones you have given. This is what makes it possible | 196 | characters. This makes it possible to type @kbd{M-x ins @key{SPC} b |
| 207 | to type @kbd{M-x ins @key{SPC} b @key{RET}} instead of @kbd{M-x | 197 | @key{RET}} instead of @kbd{M-x insert-buffer @key{RET}}, for example. |
| 208 | insert-buffer @key{RET}} (for example). (@key{SPC} does not do | 198 | |
| 209 | completion in reading file names, because it is common to use spaces | 199 | Case is significant in completion when it is significant in the |
| 210 | in file names on some systems.) | 200 | argument you are entering (buffer names, file names, command names, |
| 211 | 201 | for instance). Thus, @samp{fo} does not complete to @samp{Foo}. | |
| 212 | Case is normally significant in completion, because it is significant | 202 | Completion ignores case distinctions for certain arguments in which |
| 213 | in most of the names that you can complete (buffer names, file names and | ||
| 214 | command names). Thus, @samp{fo} does not complete to @samp{Foo}. | ||
| 215 | Completion does ignore case distinctions for certain arguments in which | ||
| 216 | case does not matter. | 203 | case does not matter. |
| 217 | 204 | ||
| 218 | Completion acts only on the text before point. If there is text in | 205 | Completion acts only on the text before point. If there is text in |
| @@ -230,42 +217,39 @@ typing some text into the minibuffer---it remains unchanged. | |||
| 230 | @subsection Completion Example | 217 | @subsection Completion Example |
| 231 | 218 | ||
| 232 | @kindex TAB @r{(completion)} | 219 | @kindex TAB @r{(completion)} |
| 233 | @findex minibuffer-complete | 220 | A concrete example may help here. If you type @kbd{M-x au |
| 234 | A concrete example may help here. If you type @kbd{M-x au @key{TAB}}, | 221 | @key{TAB}}, the @key{TAB} looks for alternatives (in this case, |
| 235 | the @key{TAB} looks for alternatives (in this case, command names) that | 222 | command names) that start with @samp{au}. There are several, |
| 236 | start with @samp{au}. There are several, including | 223 | including @code{auto-fill-mode} and @code{auto-save-mode}, but they |
| 237 | @code{auto-fill-mode} and @code{auto-save-mode}---but they are all the | 224 | all begin with @code{auto-}, so the @samp{au} in the minibuffer |
| 238 | same as far as @code{auto-}, so the @samp{au} in the minibuffer changes | 225 | completes to @samp{auto-}. |
| 239 | to @samp{auto-}.@refill | 226 | |
| 240 | 227 | If you type @key{TAB} again immediately, it cannot determine the | |
| 241 | If you type @key{TAB} again immediately, there are multiple | 228 | next character; it could be any of @samp{cfilrs}. So it does not add |
| 242 | possibilities for the very next character---it could be any of | 229 | any characters; instead, @key{TAB} displays a list of all possible |
| 243 | @samp{cfilrs}---so no more characters are added; instead, @key{TAB} | 230 | completions in another window. |
| 244 | displays a list of all possible completions in another window. | 231 | |
| 245 | 232 | Now type @kbd{f @key{TAB}}. This @key{TAB} sees @samp{auto-f}. The | |
| 246 | If you go on to type @kbd{f @key{TAB}}, this @key{TAB} sees | 233 | only command name starting with that is @code{auto-fill-mode}, so |
| 247 | @samp{auto-f}. The only command name starting this way is | 234 | completion fills in the rest of that. You have been able to enter |
| 248 | @code{auto-fill-mode}, so completion fills in the rest of that. You now | 235 | @samp{auto-fill-mode} by typing just @kbd{au @key{TAB} f @key{TAB}}. |
| 249 | have @samp{auto-fill-mode} in the minibuffer after typing just @kbd{au | ||
| 250 | @key{TAB} f @key{TAB}}. Note that @key{TAB} has this effect because in | ||
| 251 | the minibuffer it is bound to the command @code{minibuffer-complete} | ||
| 252 | when completion is available. | ||
| 253 | 236 | ||
| 254 | @node Completion Commands | 237 | @node Completion Commands |
| 255 | @subsection Completion Commands | 238 | @subsection Completion Commands |
| 256 | 239 | ||
| 257 | Here is a list of the completion commands defined in the minibuffer | 240 | Here is a list of the completion commands defined in the minibuffer |
| 258 | when completion is available. | 241 | when completion is allowed. |
| 259 | 242 | ||
| 260 | @table @kbd | 243 | @table @kbd |
| 261 | @item @key{TAB} | 244 | @item @key{TAB} |
| 245 | @findex minibuffer-complete | ||
| 262 | Complete the text before point in the minibuffer as much as possible | 246 | Complete the text before point in the minibuffer as much as possible |
| 263 | (@code{minibuffer-complete}). | 247 | (@code{minibuffer-complete}). |
| 264 | @item @key{SPC} | 248 | @item @key{SPC} |
| 265 | Complete the minibuffer text before point, but don't go beyond one | 249 | Complete up to one word from the minibuffer text before point |
| 266 | word (@code{minibuffer-complete-word}). @key{SPC} for completion is | 250 | (@code{minibuffer-complete-word}). @key{SPC} for completion is not |
| 267 | not available when entering a file name, since some users often put | 251 | available when entering a file name, since file names often include |
| 268 | spaces in filenames. | 252 | spaces. |
| 269 | @item @key{RET} | 253 | @item @key{RET} |
| 270 | Submit the text in the minibuffer as the argument, possibly completing | 254 | Submit the text in the minibuffer as the argument, possibly completing |
| 271 | first as described | 255 | first as described |
| @@ -277,31 +261,30 @@ in the next node (@code{minibuffer-complete-and-exit}). @xref{Strict | |||
| 277 | Completion}. | 261 | Completion}. |
| 278 | @end ifnottex | 262 | @end ifnottex |
| 279 | @item ? | 263 | @item ? |
| 280 | Display a list of all possible completions of the text in the minibuffer | 264 | Display a list of possible completions of the text before point |
| 281 | (@code{minibuffer-completion-help}). | 265 | (@code{minibuffer-completion-help}). |
| 282 | @end table | 266 | @end table |
| 283 | 267 | ||
| 284 | @kindex SPC | 268 | @kindex SPC |
| 285 | @findex minibuffer-complete-word | 269 | @findex minibuffer-complete-word |
| 286 | @key{SPC} completes much like @key{TAB}, but never goes beyond the | 270 | @key{SPC} completes like @key{TAB}, but only up to the next hyphen |
| 287 | next hyphen or space. If you have @samp{auto-f} in the minibuffer and | 271 | or space. If you have @samp{auto-f} in the minibuffer and type |
| 288 | type @key{SPC}, it finds that the completion is @samp{auto-fill-mode}, | 272 | @key{SPC}, it finds that the completion is @samp{auto-fill-mode}, but |
| 289 | but it stops completing after @samp{fill-}. This gives | 273 | it only inserts @samp{ill-}, giving @samp{auto-fill-}. Another |
| 290 | @samp{auto-fill-}. Another @key{SPC} at this point completes all the | 274 | @key{SPC} at this point completes all the way to |
| 291 | way to @samp{auto-fill-mode}. The command that implements this | 275 | @samp{auto-fill-mode}. The command that implements this behavior is |
| 292 | behavior is called @code{minibuffer-complete-word}. | 276 | called @code{minibuffer-complete-word}. |
| 293 | 277 | ||
| 294 | Here are some commands you can use to choose a completion from a | 278 | When you display a list of possible completions, you can choose |
| 295 | window that displays a list of completions: | 279 | one from it: |
| 296 | 280 | ||
| 297 | @table @kbd | 281 | @table @kbd |
| 298 | @findex mouse-choose-completion | 282 | @findex mouse-choose-completion |
| 299 | @item Mouse-1 | 283 | @item Mouse-1 |
| 300 | @itemx Mouse-2 | 284 | @itemx Mouse-2 |
| 301 | Clicking mouse button 1 or 2 on a completion in the list of possible | 285 | Clicking mouse button 1 or 2 on a completion possibility chooses that |
| 302 | completions chooses that completion (@code{mouse-choose-completion}). | 286 | completion (@code{mouse-choose-completion}). You must click in the |
| 303 | You normally use this command while point is in the minibuffer, but you | 287 | list of completions, not in the minibuffer. |
| 304 | must click in the list of completions, not in the minibuffer itself. | ||
| 305 | 288 | ||
| 306 | @findex switch-to-completions | 289 | @findex switch-to-completions |
| 307 | @item @key{PRIOR} | 290 | @item @key{PRIOR} |
| @@ -309,98 +292,91 @@ must click in the list of completions, not in the minibuffer itself. | |||
| 309 | Typing @key{PRIOR} or @key{PAGE-UP}, or @kbd{M-v}, while in the | 292 | Typing @key{PRIOR} or @key{PAGE-UP}, or @kbd{M-v}, while in the |
| 310 | minibuffer, selects the window showing the completion list buffer | 293 | minibuffer, selects the window showing the completion list buffer |
| 311 | (@code{switch-to-completions}). This paves the way for using the | 294 | (@code{switch-to-completions}). This paves the way for using the |
| 312 | commands below. (Selecting that window in the usual ways has the same | 295 | commands below. (Selecting that window in other ways has the same |
| 313 | effect, but this way is more convenient.) | 296 | effect.) |
| 314 | 297 | ||
| 315 | @findex choose-completion | 298 | @findex choose-completion |
| 316 | @item @key{RET} | 299 | @item @key{RET} |
| 317 | Typing @key{RET} @emph{in the completion list buffer} chooses the | 300 | Typing @key{RET} @emph{in the completion list buffer} chooses the |
| 318 | completion that point is in or next to (@code{choose-completion}). To | 301 | completion that point is in or next to (@code{choose-completion}). To |
| 319 | use this command, you must first switch windows to the window that shows | 302 | use this command, you must first switch to the completion list window. |
| 320 | the list of completions. | ||
| 321 | 303 | ||
| 322 | @findex next-completion | 304 | @findex next-completion |
| 323 | @item @key{RIGHT} | 305 | @item @key{RIGHT} |
| 324 | Typing the right-arrow key @key{RIGHT} @emph{in the completion list | 306 | Typing the right-arrow key @key{RIGHT} @emph{in the completion list |
| 325 | buffer} moves point to the following completion (@code{next-completion}). | 307 | buffer} moves point to the following completion possibility |
| 308 | (@code{next-completion}). | ||
| 326 | 309 | ||
| 327 | @findex previous-completion | 310 | @findex previous-completion |
| 328 | @item @key{LEFT} | 311 | @item @key{LEFT} |
| 329 | Typing the left-arrow key @key{LEFT} @emph{in the completion list | 312 | Typing the left-arrow key @key{LEFT} @emph{in the completion list |
| 330 | buffer} moves point toward the beginning of the buffer, to the previous | 313 | buffer} moves point to the previous completion possibility |
| 331 | completion (@code{previous-completion}). | 314 | (@code{previous-completion}). |
| 332 | @end table | 315 | @end table |
| 333 | 316 | ||
| 334 | @node Strict Completion | 317 | @node Strict Completion |
| 335 | @subsection Strict Completion | 318 | @subsection Strict Completion |
| 336 | 319 | ||
| 337 | There are three different ways that @key{RET} can work in completing | 320 | There are three different ways that @key{RET} can do completion, |
| 338 | minibuffers, depending on how the argument will be used. | 321 | depending on how the argument will be used. |
| 339 | 322 | ||
| 340 | @itemize @bullet | 323 | @itemize @bullet |
| 341 | @item | 324 | @item |
| 342 | @dfn{Strict} completion is used when it is meaningless to give any | 325 | @dfn{Strict} completion accepts only known completion candidates. For |
| 343 | argument except one of the known alternatives. For example, when | 326 | example, when @kbd{C-x k} reads the name of a buffer to kill, only the |
| 344 | @kbd{C-x k} reads the name of a buffer to kill, it is meaningless to | 327 | name of an existing buffer makes sense. In strict completion, |
| 345 | give anything but the name of an existing buffer. In strict | 328 | @key{RET} refuses to exit if the text in the minibuffer does not |
| 346 | completion, @key{RET} refuses to exit if the text in the minibuffer | 329 | complete to an exact match. |
| 347 | does not complete to an exact match. | ||
| 348 | 330 | ||
| 349 | @item | 331 | @item |
| 350 | @dfn{Cautious} completion is similar to strict completion, except that | 332 | @dfn{Cautious} completion is similar to strict completion, except that |
| 351 | @key{RET} exits only if the text was an exact match already, not | 333 | @key{RET} exits only if the text is an already exact match. |
| 352 | needing completion. If the text is not an exact match, @key{RET} does | 334 | Otherwise, @key{RET} does not exit, but it does complete the text. If |
| 353 | not exit, but it does complete the text. If it completes to an exact | 335 | that completes to an exact match, a second @key{RET} will exit. |
| 354 | match, a second @key{RET} will exit. | ||
| 355 | 336 | ||
| 356 | Cautious completion is used for reading file names for files that must | 337 | Cautious completion is used for reading file names for files that must |
| 357 | already exist. | 338 | already exist, for example. |
| 358 | 339 | ||
| 359 | @item | 340 | @item |
| 360 | @dfn{Permissive} completion is used when any string whatever is | 341 | @dfn{Permissive} completion allows any input; the completion |
| 361 | meaningful, and the list of completion alternatives is just a guide. | 342 | candidates are just suggestions. For example, when @kbd{C-x C-f} |
| 362 | For example, when @kbd{C-x C-f} reads the name of a file to visit, any | 343 | reads the name of a file to visit, any file name is allowed, including |
| 363 | file name is allowed, in case you want to create a file. In | 344 | nonexistent file (in case you want to create a file). In permissive |
| 364 | permissive completion, @key{RET} takes the text in the minibuffer | 345 | completion, @key{RET} does not complete, it just submits the argument |
| 365 | exactly as given, without completing it. | 346 | as you have entered it. |
| 366 | @end itemize | 347 | @end itemize |
| 367 | 348 | ||
| 368 | The completion commands display a list of all possible completions in | 349 | The completion commands display a list of all possible completions |
| 369 | a window whenever there is more than one possibility for the very next | 350 | whenever they can't determine even one more character by completion. |
| 370 | character. Also, typing @kbd{?} explicitly requests such a list. If | 351 | Also, typing @kbd{?} explicitly requests such a list. You can scroll |
| 371 | the list of completions is long, you can scroll it with @kbd{C-M-v} | 352 | the list with @kbd{C-M-v} (@pxref{Other Window}). |
| 372 | (@pxref{Other Window}). | ||
| 373 | 353 | ||
| 374 | @node Completion Options | 354 | @node Completion Options |
| 375 | @subsection Completion Options | 355 | @subsection Completion Options |
| 376 | 356 | ||
| 377 | @vindex completion-ignored-extensions | 357 | @vindex completion-ignored-extensions |
| 378 | @cindex ignored file names, in completion | 358 | @cindex ignored file names, in completion |
| 379 | When completion is done on file names, certain file names are usually | 359 | When completing file names, certain file names are usually ignored. |
| 380 | ignored. The variable @code{completion-ignored-extensions} contains a | 360 | The variable @code{completion-ignored-extensions} contains a list of |
| 381 | list of strings; a file whose name ends in any of those strings is | 361 | strings; a file name ending in any of those strings is ignored as a |
| 382 | ignored as a possible completion. The standard value of this variable | 362 | completion candidate. The standard value of this variable has several |
| 383 | has several elements including @code{".o"}, @code{".elc"}, @code{".dvi"} | 363 | elements including @code{".o"}, @code{".elc"}, @code{".dvi"} and |
| 384 | and @code{"~"}. The effect is that, for example, @samp{foo} can | 364 | @code{"~"}. The effect is that, for example, @samp{foo} can complete |
| 385 | complete to @samp{foo.c} even though @samp{foo.o} exists as well. | 365 | to @samp{foo.c} even though @samp{foo.o} exists as well. However, if |
| 386 | However, if @emph{all} the possible completions end in ``ignored'' | 366 | @emph{all} the possible completions end in ``ignored'' strings, then |
| 387 | strings, then they are not ignored. Ignored extensions do not apply to | 367 | they are not ignored. Displaying a list of possible completions |
| 388 | lists of completions---those always mention all possible completions. | 368 | disregards @code{completion-ignored-extensions}; it shows them all. |
| 389 | 369 | ||
| 390 | If an element of the list in @code{completion-ignored-extensions} ends | 370 | If an element of @code{completion-ignored-extensions} ends in a |
| 391 | in a slash @file{/}, it indicates a subdirectory that should be ignored | 371 | slash (@file{/}), it's a subdirectory name; then that directory and |
| 392 | when completing file names. Elements of | 372 | its contents are ignored. Elements of |
| 393 | @code{completion-ignored-extensions} which do not end in a slash are | 373 | @code{completion-ignored-extensions} which do not end in a slash are |
| 394 | never considered when a completion candidate is a directory; thus, | 374 | ordinary file names, and do not apply to names of directories. |
| 395 | completion returns directories whose names end in @file{.elc} even | ||
| 396 | though there's an element @code{".elc"} in the list. | ||
| 397 | 375 | ||
| 398 | @vindex completion-auto-help | 376 | @vindex completion-auto-help |
| 399 | Normally, a completion command that cannot determine even one | 377 | If @code{completion-auto-help} is set to @code{nil}, the completion |
| 400 | additional character automatically displays a list of all possible | 378 | commands never display a list of possibilities; you must type @kbd{?} |
| 401 | completions. If the variable @code{completion-auto-help} is set to | 379 | to display the list. |
| 402 | @code{nil}, this automatic display is disabled, so you must type | ||
| 403 | @kbd{?} to display the list of completions. | ||
| 404 | 380 | ||
| 405 | @cindex Partial Completion mode | 381 | @cindex Partial Completion mode |
| 406 | @vindex partial-completion-mode | 382 | @vindex partial-completion-mode |
| @@ -408,30 +384,29 @@ completions. If the variable @code{completion-auto-help} is set to | |||
| 408 | Partial Completion mode implements a more powerful kind of | 384 | Partial Completion mode implements a more powerful kind of |
| 409 | completion that can complete multiple words in parallel. For example, | 385 | completion that can complete multiple words in parallel. For example, |
| 410 | it can complete the command name abbreviation @code{p-b} into | 386 | it can complete the command name abbreviation @code{p-b} into |
| 411 | @code{print-buffer}, because no other command starts with two words | 387 | @code{print-buffer} if no other command starts with two words whose |
| 412 | whose initials are @samp{p} and @samp{b}. | 388 | initials are @samp{p} and @samp{b}. |
| 389 | |||
| 390 | To enable this mode, use @kbd{M-x partial-completion-mode}, or | ||
| 391 | customize the variable @code{partial-completion-mode}. This mode | ||
| 392 | binds special partial completion commands to @key{TAB}, @key{SPC}, | ||
| 393 | @key{RET}, and @kbd{?} in the minibuffer. The usual completion | ||
| 394 | commands are available on @kbd{M-@key{TAB}} (or @kbd{C-M-i}), | ||
| 395 | @kbd{M-@key{SPC}}, @kbd{M-@key{RET}} and @kbd{M-?}. | ||
| 413 | 396 | ||
| 414 | Partial completion of directories in file names uses @samp{*} to | 397 | Partial completion of directories in file names uses @samp{*} to |
| 415 | indicate the places for completion; thus, @file{/u*/b*/f*} might | 398 | indicate the places for completion; thus, @file{/u*/b*/f*} might |
| 416 | complete to @file{/usr/bin/foo}. | 399 | complete to @file{/usr/bin/foo}. For remote files, partial completion |
| 417 | 400 | enables completion of methods, user names and host names. | |
| 418 | For remote files, partial completion enables completion of methods, | 401 | @xref{Remote Files}. |
| 419 | user names and host names. @xref{Remote Files}. | ||
| 420 | |||
| 421 | To enable this mode, use the command @kbd{M-x | ||
| 422 | partial-completion-mode}, or customize the variable | ||
| 423 | @code{partial-completion-mode}. This binds the partial completion | ||
| 424 | commands to @key{TAB}, @key{SPC}, @key{RET}, and @kbd{?}. The usual | ||
| 425 | completion commands are available on @kbd{M-@key{TAB}} (or | ||
| 426 | @kbd{C-M-i}), @kbd{M-@key{SPC}}, @kbd{M-@key{RET}} and @kbd{M-?}. | ||
| 427 | 402 | ||
| 428 | @vindex PC-include-file-path | 403 | @vindex PC-include-file-path |
| 429 | @vindex PC-disable-includes | 404 | @vindex PC-disable-includes |
| 430 | Another feature of Partial Completion mode is to extend | 405 | Partial Completion mode also extends @code{find-file} so that |
| 431 | @code{find-file} so that @samp{<@var{include}>} stands for the | 406 | @samp{<@var{include}>} looks for the file named @var{include} in the |
| 432 | file named @var{include} in some directory in the path | 407 | directories in the path @code{PC-include-file-path}. If you set |
| 433 | @code{PC-include-file-path}. If you set @code{PC-disable-includes} to | 408 | @code{PC-disable-includes} to non-@code{nil}, this feature is |
| 434 | non-@code{nil}, this feature is disabled. | 409 | disabled. |
| 435 | 410 | ||
| 436 | @cindex Icomplete mode | 411 | @cindex Icomplete mode |
| 437 | @findex icomplete-mode | 412 | @findex icomplete-mode |
| @@ -446,52 +421,50 @@ icomplete-mode}. | |||
| 446 | @cindex history of minibuffer input | 421 | @cindex history of minibuffer input |
| 447 | 422 | ||
| 448 | Every argument that you enter with the minibuffer is saved on a | 423 | Every argument that you enter with the minibuffer is saved on a |
| 449 | @dfn{minibuffer history list} so that you can use it again later in | 424 | @dfn{minibuffer history list} so you can easily use it again later. |
| 450 | another argument. Special commands load the text of an earlier argument | 425 | Special commands fetch the text of an earlier argument into the |
| 451 | in the minibuffer. They discard the old minibuffer contents, so you can | 426 | minibuffer, replacing the old minibuffer contents. You can think of |
| 452 | think of them as moving through the history of previous arguments. | 427 | them as moving through the history of previous arguments. |
| 453 | 428 | ||
| 454 | @table @kbd | 429 | @table @kbd |
| 455 | @item @key{UP} | 430 | @item @key{UP} |
| 456 | @itemx M-p | 431 | @itemx M-p |
| 457 | Move to the next earlier argument string saved in the minibuffer history | 432 | Move to the previous item in the minibuffer history, an earlier argument |
| 458 | (@code{previous-history-element}). | 433 | (@code{previous-history-element}). |
| 459 | @item @key{DOWN} | 434 | @item @key{DOWN} |
| 460 | @itemx M-n | 435 | @itemx M-n |
| 461 | Move to the next later argument string saved in the minibuffer history | 436 | Move to the next item in the minibuffer history |
| 462 | (@code{next-history-element}). | 437 | (@code{next-history-element}). |
| 463 | @item M-r @var{regexp} @key{RET} | 438 | @item M-r @var{regexp} @key{RET} |
| 464 | Move to an earlier saved argument in the minibuffer history that has a | 439 | Move to an earlier item in the minibuffer history that |
| 465 | match for @var{regexp} (@code{previous-matching-history-element}). | 440 | matches @var{regexp} (@code{previous-matching-history-element}). |
| 466 | @item M-s @var{regexp} @key{RET} | 441 | @item M-s @var{regexp} @key{RET} |
| 467 | Move to a later saved argument in the minibuffer history that has a | 442 | Move to a later item in the minibuffer history that matches |
| 468 | match for @var{regexp} (@code{next-matching-history-element}). | 443 | @var{regexp} (@code{next-matching-history-element}). |
| 469 | @end table | 444 | @end table |
| 470 | 445 | ||
| 471 | @kindex M-p @r{(minibuffer history)} | 446 | @kindex M-p @r{(minibuffer history)} |
| 472 | @kindex M-n @r{(minibuffer history)} | 447 | @kindex M-n @r{(minibuffer history)} |
| 473 | @findex next-history-element | 448 | @findex next-history-element |
| 474 | @findex previous-history-element | 449 | @findex previous-history-element |
| 475 | The simplest way to reuse the saved arguments in the history list is | 450 | To move through the minibuffer history list one item at a time, use |
| 476 | to move through the history list one element at a time. While in the | 451 | @kbd{M-p} or up-arrow (@code{previous-history-element}) to fetch the |
| 477 | minibuffer, use @kbd{M-p} or up-arrow | 452 | next earlier minibuffer input, and use @kbd{M-n} or down-arrow |
| 478 | (@code{previous-history-element}) to ``move to'' the next earlier | 453 | (@code{next-history-element}) to fetch the next later input. These |
| 479 | minibuffer input, and use @kbd{M-n} or down-arrow | 454 | commands don't move the cursor, they pull different saved strings into |
| 480 | (@code{next-history-element}) to ``move to'' the next later input. | 455 | the minibuffer. But you can think of them as ``moving'' through the |
| 481 | These commands don't move the cursor, they bring different saved | 456 | history list. |
| 482 | strings into the minibuffer. But you can think of them as ``moving'' | 457 | |
| 483 | through the history list. | 458 | The input that you fetch from the history entirely replaces the |
| 484 | 459 | contents of the minibuffer. To use it again unchanged, just type | |
| 485 | The previous input that you fetch from the history entirely replaces | 460 | @key{RET}. You can also edit the text before you reuse it; this does |
| 486 | the contents of the minibuffer. To use it as the argument, exit the | 461 | not change the history element that you ``moved'' to, but your new |
| 487 | minibuffer as usual with @key{RET}. You can also edit the text before | 462 | argument does go at the end of the history list in its own right. |
| 488 | you reuse it; this does not change the history element that you | 463 | |
| 489 | ``moved'' to, but your new argument does go at the end of the history | 464 | For many minibuffer arguments there is a ``default'' value. You can |
| 490 | list in its own right. | 465 | insert the default value into the minibuffer as text by using |
| 491 | 466 | @kbd{M-n}. You can think of this as moving ``into the future'' in the | |
| 492 | For many minibuffer arguments there is a ``default'' value. Then | 467 | history. |
| 493 | you can insert the default value into the minibuffer as text by using | ||
| 494 | @kbd{M-n} to move ``into the future'' in the history. | ||
| 495 | 468 | ||
| 496 | @findex previous-matching-history-element | 469 | @findex previous-matching-history-element |
| 497 | @findex next-matching-history-element | 470 | @findex next-matching-history-element |
| @@ -499,14 +472,13 @@ you can insert the default value into the minibuffer as text by using | |||
| 499 | @kindex M-s @r{(minibuffer history)} | 472 | @kindex M-s @r{(minibuffer history)} |
| 500 | There are also commands to search forward or backward through the | 473 | There are also commands to search forward or backward through the |
| 501 | history; they search for history elements that match a regular | 474 | history; they search for history elements that match a regular |
| 502 | expression that you specify with the minibuffer. @kbd{M-r} | 475 | expression. @kbd{M-r} (@code{previous-matching-history-element}) |
| 503 | (@code{previous-matching-history-element}) searches older elements in | 476 | searches older elements in the history, while @kbd{M-s} |
| 504 | the history, while @kbd{M-s} (@code{next-matching-history-element}) | 477 | (@code{next-matching-history-element}) searches newer elements. These |
| 505 | searches newer elements. By special dispensation, these commands can | 478 | commands are unusual; they use the minibuffer to read the regular |
| 506 | use the minibuffer to read their arguments even though you are already | 479 | expression even though they are invoked from the minibuffer. As with |
| 507 | in the minibuffer when you issue them. As with incremental searching, | 480 | incremental searching, an upper-case letter in the regular expression |
| 508 | an upper-case letter in the regular expression makes the search | 481 | makes the search case-sensitive (@pxref{Search Case}). |
| 509 | case-sensitive (@pxref{Search Case}). | ||
| 510 | 482 | ||
| 511 | @ignore | 483 | @ignore |
| 512 | We may change the precise way these commands read their arguments. | 484 | We may change the precise way these commands read their arguments. |
| @@ -519,46 +491,45 @@ actually available, type @kbd{C-h f previous-matching-history-element}. | |||
| 519 | @end ignore | 491 | @end ignore |
| 520 | 492 | ||
| 521 | All uses of the minibuffer record your input on a history list, but | 493 | All uses of the minibuffer record your input on a history list, but |
| 522 | there are separate history lists for different kinds of arguments. For | 494 | there are separate history lists for different kinds of arguments. |
| 523 | example, there is a list for file names, used by all the commands that | 495 | For example, there is a list for file names, used by all the commands |
| 524 | read file names. (As a special feature, this history list records | 496 | that read file names. (As a special feature, this history list |
| 525 | the absolute file name, no more and no less, even if that is not how | 497 | records the absolute file name, even if the name you entered was not |
| 526 | you entered the file name.) | 498 | absolute.) |
| 527 | 499 | ||
| 528 | There are several other very specific history lists, including one for | 500 | There are several other specific history lists, including one for |
| 529 | command names read by @kbd{M-x}, one for buffer names, one for arguments | 501 | buffer names, one for arguments of commands like @code{query-replace}, |
| 530 | of commands like @code{query-replace}, and one for compilation commands | 502 | one used by @kbd{M-x} for command names, and one used by |
| 531 | read by @code{compile}. Finally, there is one ``miscellaneous'' history | 503 | @code{compile} for compilation commands. Finally, there is one |
| 532 | list that most minibuffer arguments use. | 504 | ``miscellaneous'' history list that most minibuffer arguments use. |
| 533 | 505 | ||
| 534 | @vindex history-length | 506 | @vindex history-length |
| 535 | The variable @code{history-length} specifies the maximum length of a | 507 | The variable @code{history-length} specifies the maximum length of a |
| 536 | minibuffer history list; once a list gets that long, the oldest element | 508 | minibuffer history list; adding a new element deletes the oldest |
| 537 | is deleted each time an element is added. If the value of | 509 | element if the list gets too long. If the value of |
| 538 | @code{history-length} is @code{t}, though, there is no maximum length | 510 | @code{history-length} is @code{t}, though, there is no maximum length. |
| 539 | and elements are never deleted. | ||
| 540 | 511 | ||
| 541 | @vindex history-delete-duplicates | 512 | @vindex history-delete-duplicates |
| 542 | The variable @code{history-delete-duplicates} specifies whether to | 513 | The variable @code{history-delete-duplicates} specifies whether to |
| 543 | delete duplicates in history. If the value of @code{history-delete-duplicates} | 514 | delete duplicates in history. If it is @code{t}, adding a new element |
| 544 | is @code{t}, that means when adding a new history element, all | 515 | deletes from the list all other elements that are equal to it. |
| 545 | previous identical elements are deleted. | ||
| 546 | 516 | ||
| 547 | @node Repetition | 517 | @node Repetition |
| 548 | @section Repeating Minibuffer Commands | 518 | @section Repeating Minibuffer Commands |
| 549 | @cindex command history | 519 | @cindex command history |
| 550 | @cindex history of commands | 520 | @cindex history of commands |
| 551 | 521 | ||
| 552 | Every command that uses the minibuffer at least once is recorded on a | 522 | Every command that uses the minibuffer once is recorded on a special |
| 553 | special history list, together with the values of its arguments, so that | 523 | history list, the @dfn{command history}, together with the values of |
| 554 | you can repeat the entire command. In particular, every use of | 524 | its arguments, so that you can repeat the entire command. In |
| 555 | @kbd{M-x} is recorded there, since @kbd{M-x} uses the minibuffer to read | 525 | particular, every use of @kbd{M-x} is recorded there, since @kbd{M-x} |
| 556 | the command name. | 526 | uses the minibuffer to read the command name. |
| 557 | 527 | ||
| 558 | @findex list-command-history | 528 | @findex list-command-history |
| 559 | @table @kbd | 529 | @table @kbd |
| 560 | @item C-x @key{ESC} @key{ESC} | 530 | @item C-x @key{ESC} @key{ESC} |
| 561 | Re-execute a recent minibuffer command (@code{repeat-complex-command}). | 531 | Re-execute a recent minibuffer command from the command history |
| 532 | (@code{repeat-complex-command}). | ||
| 562 | @item M-x list-command-history | 533 | @item M-x list-command-history |
| 563 | Display the entire command history, showing all the commands | 534 | Display the entire command history, showing all the commands |
| 564 | @kbd{C-x @key{ESC} @key{ESC}} can repeat, most recent first. | 535 | @kbd{C-x @key{ESC} @key{ESC}} can repeat, most recent first. |
| @@ -566,36 +537,33 @@ Display the entire command history, showing all the commands | |||
| 566 | 537 | ||
| 567 | @kindex C-x ESC ESC | 538 | @kindex C-x ESC ESC |
| 568 | @findex repeat-complex-command | 539 | @findex repeat-complex-command |
| 569 | @kbd{C-x @key{ESC} @key{ESC}} is used to re-execute a recent | 540 | @kbd{C-x @key{ESC} @key{ESC}} is used to re-execute a recent command |
| 570 | minibuffer-using command. With no argument, it repeats the last such | 541 | that used the minibuffer. With no argument, it repeats the last such |
| 571 | command. A numeric argument specifies which command to repeat; one | 542 | command. A numeric argument specifies which command to repeat; 1 |
| 572 | means the last one, and larger numbers specify earlier ones. | 543 | means the last one, 2 the previous, and so on. |
| 573 | 544 | ||
| 574 | @kbd{C-x @key{ESC} @key{ESC}} works by turning the previous command | 545 | @kbd{C-x @key{ESC} @key{ESC}} works by turning the previous command |
| 575 | into a Lisp expression and then entering a minibuffer initialized with | 546 | into a Lisp expression and then entering a minibuffer initialized with |
| 576 | the text for that expression. If you type just @key{RET}, the command | 547 | the text for that expression. Even if you don't understand Lisp |
| 577 | is repeated as before. You can also change the command by editing the | 548 | syntax, it will probably be obvious which command is displayed for |
| 578 | Lisp expression. Whatever expression you finally submit is what will be | 549 | repetition. If you type just @key{RET}, that repeats the command |
| 579 | executed. The repeated command is added to the front of the command | 550 | unchanged. You can also change the command by editing the Lisp |
| 580 | history unless it is identical to the most recently executed command | 551 | expression before you execute it. The repeated command is added to |
| 581 | already there. | 552 | the front of the command history unless it is identical to the most |
| 582 | 553 | recently item. | |
| 583 | Even if you don't understand Lisp syntax, it will probably be obvious | ||
| 584 | which command is displayed for repetition. If you do not change the | ||
| 585 | text, it will repeat exactly as before. | ||
| 586 | 554 | ||
| 587 | Once inside the minibuffer for @kbd{C-x @key{ESC} @key{ESC}}, you can | 555 | Once inside the minibuffer for @kbd{C-x @key{ESC} @key{ESC}}, you can |
| 588 | use the minibuffer history commands (@kbd{M-p}, @kbd{M-n}, @kbd{M-r}, | 556 | use the minibuffer history commands (@kbd{M-p}, @kbd{M-n}, @kbd{M-r}, |
| 589 | @kbd{M-s}; @pxref{Minibuffer History}) to move through the history list | 557 | @kbd{M-s}; @pxref{Minibuffer History}) to move through the history list |
| 590 | of saved entire commands. After finding the desired previous command, | 558 | of saved entire commands. After finding the desired previous command, |
| 591 | you can edit its expression as usual and then resubmit it by typing | 559 | you can edit its expression as usual and then repeat it by typing |
| 592 | @key{RET} as usual. | 560 | @key{RET}. |
| 593 | 561 | ||
| 594 | @vindex isearch-resume-in-command-history | 562 | @vindex isearch-resume-in-command-history |
| 595 | Incremental search does not, strictly speaking, use the minibuffer, | 563 | Incremental search does not, strictly speaking, use the minibuffer. |
| 596 | but it does something similar. Although it behaves like a complex command, | 564 | Therefore, although it behaves like a complex command, it normally |
| 597 | it normally does not appear in the history list for @kbd{C-x | 565 | does not appear in the history list for @kbd{C-x @key{ESC} @key{ESC}}. |
| 598 | @key{ESC} @key{ESC}}. You can make it appear in the history by | 566 | You can make incremental search commands appear in the history by |
| 599 | setting @code{isearch-resume-in-command-history} to a non-@code{nil} | 567 | setting @code{isearch-resume-in-command-history} to a non-@code{nil} |
| 600 | value. @xref{Incremental Search}. | 568 | value. @xref{Incremental Search}. |
| 601 | 569 | ||