annotate man/xemacs/mini.texi @ 5679:a81a739181dc

Add command remapping, a more robust alternative to #'substitute-key-definition src/ChangeLog addition: 2012-09-02 Aidan Kehoe <kehoea@parhasard.net> * keymap.c: Add command remapping, a more robust equivalent to #'substitute-key-definition. * keymap.c (CHECK_REMAPPING_POSITION): New. * keymap.c (keymap_equal): Correct a comment here. * keymap.c (Fdefine_key): Document the command remapping syntax. * keymap.c (Fremap_command): New. * keymap.c (command_remapping): New. * keymap.c (Fcommand_remapping): New. * keymap.c (commands_remapped_to_mapper): New. * keymap.c (commands_remapped_to_traverser): New. * keymap.c (Fcommands_remapped_to): New. * keymap.c (get_relevant_keymaps): Take a new POSITION argument. * keymap.c (Fcurrent_keymaps, event_binding): Supply the new POSITION argument to get_relevant_keymaps. * keymap.c (Fkey_binding): Add new arguments, NO-REMAP and POSITION. * keymap.c (map_keymap_mapper): * keymap.c (Fwhere_is_internal): * keymap.c (where_is_to_char): * keymap.c (where_is_recursive_mapper): Don't expose the key remapping in these functions. This conflicts with GNU, but is more sane for our callers. Access to command remapping is with the functions #'command-remapping, #'commands-remapped-to, and #'remap-command, not with the general keymap functions, apart from the compatibility hack in #'define-key. * keymap.c (syms_of_keymap): * keymap.c (vars_of_keymap): * keymap.c (complex_vars_of_keymap): * lisp.h: New CHECK_COMMAND macro. man/ChangeLog addition: 2012-09-02 Aidan Kehoe <kehoea@parhasard.net> * lispref/keymaps.texi (Keymaps): * lispref/keymaps.texi (Changing Key Bindings): * lispref/keymaps.texi (Scanning Keymaps): * lispref/keymaps.texi (Remapping commands): * lispref/keymaps.texi (XEmacs): New. * lispref/keymaps.texi (Other Keymap Functions): Document the new command remapping functionality in this file. lisp/ChangeLog addition: 2012-09-02 Aidan Kehoe <kehoea@parhasard.net> * help.el (describe-function-1): Document any command remapping that has been done in this function. tests/ChangeLog addition: 2012-09-02 Aidan Kehoe <kehoea@parhasard.net> * automated/keymap-tests.el: Test the new command remapping functionality.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 02 Sep 2012 14:31:40 +0100
parents f561c3904bb3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1703
f561c3904bb3 [xemacs-hg @ 2003-09-20 01:46:53 by youngs]
youngs
parents: 408
diff changeset
1
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 @node Minibuffer, M-x, Undo, Top
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 @chapter The Minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 @cindex minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
7 The @dfn{minibuffer} is the facility used by XEmacs commands to read
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
8 arguments more complicated than a single number. Minibuffer arguments
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
9 can be file names, buffer names, Lisp function names, XEmacs command
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
10 names, Lisp expressions, and many other things, depending on the command
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
11 reading the argument. You can use the usual XEmacs editing commands in
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
12 the minibuffer to edit the argument text.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 @cindex prompt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 When the minibuffer is in use, it appears in the echo area, and the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 cursor moves there. The beginning of the minibuffer line displays a
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
17 @dfn{prompt} which says what kind of input you should supply and how it
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
18 will be used. Often this prompt is derived from the name of the command
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
19 that the argument is for. The prompt normally ends with a colon.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 @cindex default argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 Sometimes a @dfn{default argument} appears in parentheses after the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 colon; it, too, is part of the prompt. The default is used as the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 argument value if you enter an empty argument (e.g., by just typing @key{RET}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 For example, commands that read buffer names always show a default, which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 is the name of the buffer that will be used if you type just @key{RET}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 @kindex C-g
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
29 The simplest way to enter a minibuffer argument is to type the text
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
30 you want, terminated by @key{RET} which exits the minibuffer. You can
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
31 cancel the command that wants the argument, and get out of the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
32 minibuffer, by typing @kbd{C-g}.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 Since the minibuffer uses the screen space of the echo area, it can
1703
f561c3904bb3 [xemacs-hg @ 2003-09-20 01:46:53 by youngs]
youngs
parents: 408
diff changeset
35 conflict with other ways XEmacs customarily uses the echo area. One can
f561c3904bb3 [xemacs-hg @ 2003-09-20 01:46:53 by youngs]
youngs
parents: 408
diff changeset
36 avoid such a conflict as described in @ref{Customizing Message
f561c3904bb3 [xemacs-hg @ 2003-09-20 01:46:53 by youngs]
youngs
parents: 408
diff changeset
37 Display,,,lispref, The XEmacs Lisp Reference Manual}. Here is how
f561c3904bb3 [xemacs-hg @ 2003-09-20 01:46:53 by youngs]
youngs
parents: 408
diff changeset
38 XEmacs handles such conflicts by default:
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 If a command gets an error while you are in the minibuffer, this does
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 not cancel the minibuffer. However, the echo area is needed for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 error message and therefore the minibuffer itself is hidden for a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 while. It comes back after a few seconds, or as soon as you type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 anything.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 @item
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
49 If in the minibuffer you use a command whose purpose is to print a
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
50 message in the echo area, such as @kbd{C-x =}, the message is printed
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
51 normally, and the minibuffer is hidden for a while. It comes back
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 after a few seconds, or as soon as you type anything.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 Echoing of keystrokes does not take place while the minibuffer is in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 use.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 * File: Minibuffer File. Entering file names with the minibuffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 * Edit: Minibuffer Edit. How to edit in the minibuffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 * Completion:: An abbreviation facility for minibuffer input.
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
63 * Minibuffer History:: Reusing recent minibuffer arguments.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 * Repetition:: Re-executing commands that used the minibuffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 @node Minibuffer File, Minibuffer Edit, Minibuffer, Minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 @section Minibuffers for File Names
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 Sometimes the minibuffer starts out with text in it. For example, when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 you are supposed to give a file name, the minibuffer starts out containing
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
72 the @dfn{default directory}, which ends with a slash. This is to inform
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
73 you which directory the file will be found in if you do not specify a
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
74 directory.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
75
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
76 For example, the minibuffer might start out with these contents:
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 Find File: /u2/emacs/src/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 @noindent
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
83 where @samp{Find File:@: } is the prompt. Typing @kbd{buffer.c}
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
84 specifies the file @file{/u2/emacs/src/buffer.c}. To find files in
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
85 nearby directories, use @kbd{..}; thus, if you type
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
86 @kbd{../lisp/simple.el}, you will get the file named
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
87 @file{/u2/emacs/lisp/simple.el}. Alternatively, you can kill with
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
88 @kbd{M-@key{DEL}} the directory names you don't want (@pxref{Words}).
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
90 If you don't want any of the default, you can kill it with @kbd{C-a
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
91 C-k}. But you don't need to kill the default; you can simply ignore it.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
92 Insert an absolute file name, one starting with a slash or a tilde,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
93 after the default directory. For example, to specify the file
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
94 @file{/etc/termcap}, just insert that name, giving these minibuffer
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
95 contents:
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 Find File: /u2/emacs/src//etc/termcap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 @noindent
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
102 @cindex // in file name
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
103 @cindex double slash in file name
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
104 @cindex slashes repeated in file name
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
105 XEmacs gives a special meaning to a double slash (which is not normally
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
106 a useful thing to write): it means, ``ignore everything before the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
107 second slash in the pair.'' Thus, @samp{/u2/emacs/src/} is ignored in
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
108 the example above, and you get the file @file{/etc/termcap}.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 @vindex insert-default-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 If you set @code{insert-default-directory} to @code{nil}, the default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 directory is not inserted in the minibuffer. This way, the minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 starts out empty. But the name you type, if relative, is still
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 interpreted with respect to the same default directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 @node Minibuffer Edit, Completion, Minibuffer File, Minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 @section Editing in the Minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
119 The minibuffer is an XEmacs buffer (albeit a peculiar one), and the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
120 usual XEmacs commands are available for editing the text of an argument
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
121 you are entering.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 Since @key{RET} in the minibuffer is defined to exit the minibuffer,
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
124 you can't use it to insert a newline in the minibuffer. To do that,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
125 type @kbd{C-o} or @kbd{C-q C-j}. (Recall that a newline is really the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
126 character control-J.)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
128 The minibuffer has its own window which always has space on the screen
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
129 but acts as if it were not there when the minibuffer is not in use.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
130 When the minibuffer is in use, its window is just like the others; you
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
131 can switch to another window with @kbd{C-x o}, edit text in other
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
132 windows and perhaps even visit more files, before returning to the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
133 minibuffer to submit the argument. You can kill text in another window,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
134 return to the minibuffer window, and then yank the text to use it in the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
135 argument. @xref{Windows}.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
137 There are some restrictions on the use of the minibuffer window,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
138 however. You cannot switch buffers in it---the minibuffer and its
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
139 window are permanently attached. Also, you cannot split or kill the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
140 minibuffer window. But you can make it taller in the normal fashion with
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 398
diff changeset
141 @kbd{C-x ^}. If you enable Resize-Minibuffer mode, then the
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 398
diff changeset
142 minibuffer window expands vertically as necessary to hold the text that
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 398
diff changeset
143 you put in the minibuffer. Use @kbd{M-x resize-minibuffer-mode} to
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 398
diff changeset
144 enable or disable this minor mode (@pxref{Minor Modes}).
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 @kindex C-M-v
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
147 If while in the minibuffer you issue a command that displays help text
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
148 of any sort in another window, you can use the @kbd{C-M-v} command while
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
149 in the minibuffer to scroll the help text. This lasts until you exit
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
150 the minibuffer. This feature is especially useful if a completing
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
151 minibuffer gives you a list of possible completions. @xref{Other Window}.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
153 @vindex minibuffer-confirm-incomplete
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 If the variable @code{minibuffer-confirm-incomplete} is @code{t}, you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 are asked for confirmation if there is no known completion for the text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 you typed. For example, if you attempted to visit a non-existent file,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 the minibuffer might read:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 @example
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
159 Find File: chocolate_bar.c [no completions, confirm]
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 If you press @kbd{Return} again, that confirms the filename. Otherwise,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 you can continue editing it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
164 XEmacs supports recursive use of the minibuffer. However, it is easy
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
165 to do this by accident (because of autorepeating keyboards, for example)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
166 and get confused. Therefore, most XEmacs commands that use the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
167 minibuffer refuse to operate if the minibuffer window is selected. If
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
168 the minibuffer is active but you have switched to a different window,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
169 recursive use of the minibuffer is allowed---if you know enough to try
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
170 to do this, you probably will not get confused.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 @vindex enable-recursive-minibuffers
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
173 If you set the variable @code{enable-recursive-minibuffers} to a
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 non-@code{nil}, recursive use of the minibuffer is always allowed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
176 @node Completion, Minibuffer History, Minibuffer Edit, Minibuffer
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 @section Completion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 @cindex completion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
180 For certain kinds of arguments, you can use @dfn{completion} to enter
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
181 the argument value. Completion means that you type part of the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
182 argument, then XEmacs visibly fills in the rest, or as much as
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
183 can be determined from the part you have typed.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 When completion is available, certain keys---@key{TAB}, @key{RET}, and
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
186 @key{SPC}---are rebound to complete the text present in the
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 minibuffer into a longer string that it stands for, by matching it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 against a set of @dfn{completion alternatives} provided by the command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 reading the argument. @kbd{?} is defined to display a list of possible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 completions of what you have inserted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
192 For example, when @kbd{M-x} uses the minibuffer to read the name of a
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
193 command, it provides a list of all available XEmacs command names to
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
194 complete against. The completion keys match the text in the minibuffer
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
195 against all the command names, find any additional name characters
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
196 implied by the ones already present in the minibuffer, and add those
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
197 characters to the ones you have given. This is what makes it possible
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
198 to type @kbd{M-x inse @key{SPC} b @key{RET}} instead of @kbd{M-x
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
199 insert-buffer @key{RET}} (for example).
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
201 Case is normally significant in completion because it is significant
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
202 in most of the names that you can complete (buffer names, file names and
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
203 command names). Thus, @samp{fo} does not complete to @samp{Foo}. When
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
204 you are completing a name in which case does not matter, case may be
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
205 ignored for completion's sake if specified by program.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 When a completion list is displayed, the completions will highlight as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 you move the mouse over them. Clicking the middle mouse button on any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 highlighted completion will ``select'' it just as if you had typed it in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 and hit @key{RET}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
212 @menu
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
213 * Example: Completion Example.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
214 * Commands: Completion Commands.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
215 * Strict Completion::
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
216 * Options: Completion Options.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
217 @end menu
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
218
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
219 @node Completion Example, Completion Commands, Completion, Completion
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
220 @subsection Completion Example
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 @kindex TAB
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 @findex minibuffer-complete
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
224 A concrete example may help here. If you type @kbd{M-x au @key{TAB}},
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
225 the @key{TAB} looks for alternatives (in this case, command names) that
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
226 start with @samp{au}. There are several, including
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
227 @code{auto-fill-mode} and @code{auto-save-mode}---but they are all the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
228 same as far as @code{auto}, so the @samp{au} in the minibuffer changes
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
229 to @samp{auto}.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
231 If you type @key{TAB} again immediately, there are multiple
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
232 possibilities for the very next character---it could be any of
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
233 @samp{c-}---so no more characters are added; instead, @key{TAB}
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
234 displays a list of all possible completions in another window.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 398
diff changeset
236 If you go on to type @kbd{-f @key{TAB}}, this @key{TAB} sees
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 @samp{auto-f}. The only command name starting this way is
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
238 @code{auto-fill-mode}, so completion fills in the rest of that. You now
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
239 have @samp{auto-fill-mode} in the minibuffer after typing just @kbd{au
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
240 @key{TAB} f @key{TAB}}. Note that @key{TAB} has this effect because in
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
241 the minibuffer it is bound to the command @code{minibuffer-complete}
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
242 when completion is available.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
244 @node Completion Commands, Strict Completion, Completion Example, Completion
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 @subsection Completion Commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
247 Here is a list of the completion commands defined in the minibuffer
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 when completion is available.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 @item @key{TAB}
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
252 Complete the text in the minibuffer as much as possible
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (@code{minibuffer-complete}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 @item @key{SPC}
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
255 Complete the minibuffer text, but don't go beyond one word
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
256 (@code{minibuffer-complete-word}).
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 @item @key{RET}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 Submit the text in the minibuffer as the argument, possibly completing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 first as described below (@code{minibuffer-complete-and-exit}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 @item ?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 Print a list of all possible completions of the text in the minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (@code{minibuffer-list-completions}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 @item @key{button2}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 Select the highlighted text under the mouse as a minibuffer response.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 When the minibuffer is being used to prompt the user for a completion,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 any valid completions which are visible on the screen will be highlighted
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 when the mouse moves over them. Clicking @key{button2} will select the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 highlighted completion and exit the minibuffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 (@code{minibuf-select-highlighted-completion}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 @kindex SPC
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 @findex minibuffer-complete-word
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
274 @key{SPC} completes much like @key{TAB}, but never goes beyond the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
275 next hyphen or space. If you have @samp{auto-f} in the minibuffer and
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
276 type @key{SPC}, it finds that the completion is @samp{auto-fill-mode},
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
277 but it stops completing after @samp{fill-}. This gives
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
278 @samp{auto-fill-}. Another @key{SPC} at this point completes all the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
279 way to @samp{auto-fill-mode}. @key{SPC} in the minibuffer when
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
280 completion is available runs the command
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
281 @code{minibuffer-complete-word}.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
282
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
283 Here are some commands you can use to choose a completion from a
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
284 window that displays a list of completions:
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
285
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
286 @table @kbd
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
287 @findex mouse-choose-completion
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
288 @item button2up
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
289 Clicking mouse button 2 on a completion in the list of possible
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
290 completions chooses that completion (@code{mouse-choose-completion}).
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
291 You normally use this command while point is in the minibuffer; but you
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
292 must click in the list of completions, not in the minibuffer itself.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
293
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 398
diff changeset
294 @findex switch-to-completions
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 398
diff changeset
295 @item @key{PRIOR}
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 398
diff changeset
296 @itemx M-v
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 398
diff changeset
297 Typing @key{PRIOR} or @kbd{M-v}, while in the minibuffer, selects the
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 398
diff changeset
298 window showing the completion list buffer
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 398
diff changeset
299 (@code{switch-to-completions}). This paves the way for using the
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 398
diff changeset
300 commands below. (Selecting that window in the usual ways has the same
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 398
diff changeset
301 effect, but this way is more convenient.)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 398
diff changeset
302
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
303 @findex choose-completion
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
304 @item @key{RET}
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
305 Typing @key{RET} @emph{in the completion list buffer} chooses the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
306 completion that point is in or next to (@code{choose-completion}). To
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
307 use this command, you must first switch windows to the window that shows
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
308 the list of completions.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
309
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
310 @findex next-list-mode-item
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
311 @item @key{RIGHT}
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
312 @itemx @key{TAB}
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
313 @itemx C-f
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
314 Typing the right-arrow key @key{RIGHT}, @key{TAB} or @kbd{C-f} @emph{in
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
315 the completion list buffer} moves point to the following completion
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
316 (@code{next-list-mode-item}).
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
317
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
318 @findex previous-list-mode-item
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
319 @item @key{LEFT}
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
320 @itemx C-b
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
321 Typing the left-arrow key @key{LEFT} or @kbd{C-b} @emph{in the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
322 completion list buffer} moves point toward the beginning of the buffer,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
323 to the previous completion (@code{previous-list-mode-item}).
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
324 @end table
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
325
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
326 @node Strict Completion, Completion Options, Completion Commands, Completion
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
327 @subsection Strict Completion
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 There are three different ways that @key{RET} can work in completing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 minibuffers, depending on how the argument will be used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 @dfn{Strict} completion is used when it is meaningless to give any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 argument except one of the known alternatives. For example, when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 @kbd{C-x k} reads the name of a buffer to kill, it is meaningless to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 give anything but the name of an existing buffer. In strict
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 completion, @key{RET} refuses to exit if the text in the minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 does not complete to an exact match.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 @dfn{Cautious} completion is similar to strict completion, except that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 @key{RET} exits only if the text was an exact match already, not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 needing completion. If the text is not an exact match, @key{RET} does
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 not exit, but it does complete the text. If it completes to an exact
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 match, a second @key{RET} will exit.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 Cautious completion is used for reading file names for files that must
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 already exist.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 @item
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
352 @dfn{Permissive} completion is used when any string whatever is
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 meaningful, and the list of completion alternatives is just a guide.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 For example, when @kbd{C-x C-f} reads the name of a file to visit, any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 file name is allowed, in case you want to create a file. In
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 permissive completion, @key{RET} takes the text in the minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 exactly as given, without completing it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
360 The completion commands display a list of all possible completions in
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
361 a window whenever there is more than one possibility for the very next
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
362 character. Also, typing @kbd{?} explicitly requests such a list. If
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
363 the list of completions is long, you can scroll it with @kbd{C-M-v}
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
364 (@pxref{Other Window}).
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
365
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
366 @node Completion Options, , Strict Completion, Completion
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
367 @subsection Completion Options
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 @vindex completion-ignored-extensions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 When completion is done on file names, certain file names are usually
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
371 ignored. The variable @code{completion-ignored-extensions} contains a
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
372 list of strings; a file whose name ends in any of those strings is
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
373 ignored as a possible completion. The standard value of this variable
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
374 has several elements including @code{".o"}, @code{".elc"}, @code{".dvi"}
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
375 and @code{"~"}. The effect is that, for example, @samp{foo} can
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
376 complete to @samp{foo.c} even though @samp{foo.o} exists as well.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
377 However, if @emph{all} the possible completions end in ``ignored''
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
378 strings, then they are not ignored. Ignored extensions do not apply to
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
379 lists of completions---those always mention all possible completions.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 @vindex completion-auto-help
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 If a completion command finds the next character is undetermined, it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 automatically displays a list of all possible completions. If the variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 @code{completion-auto-help} is set to @code{nil}, this does not happen,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 and you must type @kbd{?} to display the possible completions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 @vindex minibuffer-confirm-incomplete
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 If the variable @code{minibuffer-confirm-incomplete} is set to @code{t},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 then in contexts where @code{completing-read} allows answers that are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 not valid completions, an extra @key{RET} must be typed to confirm the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 response. This is helpful for catching typos.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 398
diff changeset
393 @cindex Icomplete mode
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 398
diff changeset
394 Icomplete mode presents a constantly-updated display that tells you
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 398
diff changeset
395 what completions are available for the text you've entered so far. The
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 398
diff changeset
396 command to enable or disable this minor mode is @kbd{M-x
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 398
diff changeset
397 icomplete-mode}.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 398
diff changeset
398
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
399 @node Minibuffer History, Repetition, Completion, Minibuffer
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
400 @section Minibuffer History
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
401 @cindex minibuffer history
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
402 @cindex history of minibuffer input
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
403
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
404 Every argument that you enter with the minibuffer is saved on a
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
405 @dfn{minibuffer history list} so that you can use it again later in
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
406 another argument. Special commands load the text of an earlier argument
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
407 in the minibuffer. They discard the old minibuffer contents, so you can
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
408 think of them as moving through the history of previous arguments.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
409
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
410 @table @kbd
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
411 @item @key{UP}
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
412 @itemx M-p
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
413 Move to the next earlier argument string saved in the minibuffer history
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
414 (@code{previous-history-element}).
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
415 @item @key{DOWN}
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
416 @itemx M-n
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
417 Move to the next later argument string saved in the minibuffer history
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
418 (@code{next-history-element}).
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
419 @item M-r @var{regexp} @key{RET}
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
420 Move to an earlier saved argument in the minibuffer history that has a
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
421 match for @var{regexp} (@code{previous-matching-history-element}).
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
422 @item M-s @var{regexp} @key{RET}
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
423 Move to a later saved argument in the minibuffer history that has a
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
424 match for @var{regexp} (@code{next-matching-history-element}).
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
425 @end table
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
426
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
427 @kindex M-p @r{(minibuffer history)}
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
428 @kindex M-n @r{(minibuffer history)}
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
429 @findex next-history-element
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
430 @findex previous-history-element
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
431 The simplest way to reuse the saved arguments in the history list is
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
432 to move through the history list one element at a time. While in the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
433 minibuffer, use @kbd{M-p} or up-arrow (@code{previous-history-element})
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
434 to ``move to'' the next earlier minibuffer input, and use @kbd{M-n} or
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
435 down-arrow (@code{next-history-element}) to ``move to'' the next later
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
436 input.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
437
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
438 The previous input that you fetch from the history entirely replaces
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
439 the contents of the minibuffer. To use it as the argument, exit the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
440 minibuffer as usual with @key{RET}. You can also edit the text before
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
441 you reuse it; this does not change the history element that you
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
442 ``moved'' to, but your new argument does go at the end of the history
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
443 list in its own right.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
444
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
445 For many minibuffer arguments there is a ``default'' value. In some
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
446 cases, the minibuffer history commands know the default value. Then you
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
447 can insert the default value into the minibuffer as text by using
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
448 @kbd{M-n} to move ``into the future'' in the history.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
449
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
450 @findex previous-matching-history-element
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
451 @findex next-matching-history-element
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
452 @kindex M-r @r{(minibuffer history)}
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
453 @kindex M-s @r{(minibuffer history)}
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
454 There are also commands to search forward or backward through the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
455 history; they search for history elements that match a regular
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
456 expression that you specify with the minibuffer. @kbd{M-r}
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
457 (@code{previous-matching-history-element}) searches older elements in
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
458 the history, while @kbd{M-s} (@code{next-matching-history-element})
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
459 searches newer elements. By special dispensation, these commands can
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
460 use the minibuffer to read their arguments even though you are already
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
461 in the minibuffer when you issue them. As with incremental searching,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
462 an uppercase letter in the regular expression makes the search
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
463 case-sensitive (@pxref{Search Case}).
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
464
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
465 All uses of the minibuffer record your input on a history list, but
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
466 there are separate history lists for different kinds of arguments. For
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
467 example, there is a list for file names, used by all the commands that
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
468 read file names.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
469
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
470 There are several other very specific history lists, including one for
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
471 command names read by @kbd{M-x}, one for buffer names, one for arguments
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
472 of commands like @code{query-replace}, and one for compilation commands
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
473 read by @code{compile}. Finally, there is one ``miscellaneous'' history
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
474 list that most minibuffer arguments use.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
475
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
476 @c Do wee need this?
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
477 @ignore
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
478 @vindex history-length
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
479 The variable @code{history-length} specifies the maximum length of a
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
480 minibuffer history list; once a list gets that long, the oldest element
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
481 is deleted each time an element is added. If the value of
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
482 @code{history-length} is @code{t}, though, there is no maximum length
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
483 and elements are never deleted.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
484 @end ignore
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
485
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
486 @node Repetition, , Minibuffer History, Minibuffer
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 @section Repeating Minibuffer Commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 @cindex command history
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 @cindex history of commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 Every command that uses the minibuffer at least once is recorded on a
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
492 special history list, together with the values of its arguments, so that
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
493 you can repeat the entire command. In particular, every use of
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
494 @kbd{M-x} is recorded there, since @kbd{M-x} uses the minibuffer to read
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
495 the command name.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 @findex list-command-history
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 @c widecommands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 @table @kbd
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
500 @item C-x @key{ESC} @key{ESC}
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
501 Re-execute a recent minibuffer command (@code{repeat-complex-command}).
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 @item M-p
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 398
diff changeset
503 Within @kbd{C-x @key{ESC} @key{ESC}}, move to previous recorded command
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 (@code{previous-history-element}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 @item M-n
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 398
diff changeset
506 Within @kbd{C-x @key{ESC} @key{ESC}}, move to the next (more recent)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 398
diff changeset
507 recorded command (@code{next-history-element}).
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 @item M-x list-command-history
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 Display the entire command history, showing all the commands
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
510 @kbd{C-x @key{ESC} @key{ESC}} can repeat, most recent first.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
513 @kindex C-x ESC ESC
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 @findex repeat-complex-command
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
515 @kbd{C-x @key{ESC} @key{ESC}} is used to re-execute a recent
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
516 minibuffer-using command. With no argument, it repeats the last such
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
517 command. A numeric argument specifies which command to repeat; one
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
518 means the last one, and larger numbers specify earlier ones.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
520 @kbd{C-x @key{ESC} @key{ESC}} works by turning the previous command
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
521 into a Lisp expression and then entering a minibuffer initialized with
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
522 the text for that expression. If you type just @key{RET}, the command
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
523 is repeated as before. You can also change the command by editing the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
524 Lisp expression. Whatever expression you finally submit is what will be
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
525 executed. The repeated command is added to the front of the command
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
526 history unless it is identical to the most recently executed command
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
527 already there.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 Even if you don't understand Lisp syntax, it will probably be obvious
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 which command is displayed for repetition. If you do not change the text,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 you can be sure the command will repeat exactly as before.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 @kindex M-n
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 @kindex M-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 @findex next-complex-command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 @findex previous-complex-command
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
537 If you are in the minibuffer for @kbd{C-x @key{ESC} @key{ESC}} and the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
538 command shown to you is not the one you want to repeat, you can move
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
539 around the list of previous commands using @kbd{M-n} and @kbd{M-p}.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
540 @kbd{M-p} replaces the contents of the minibuffer with the next earlier
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
541 recorded command, and @kbd{M-n} replaces it with the next later command.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
542 After finding the desired previous command, you can edit its expression
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
543 and then resubmit it by typing @key{RET}. Any editing you have done on
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
544 the command to be repeated is lost if you use @kbd{M-n} or @kbd{M-p}.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
546 @kbd{M-n} and @kbd{M-p} are specially defined within @kbd{C-x @key{ESC}
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 0
diff changeset
547 @key{ESC}} to run the commands @code{previous-history-element} and
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 @code{next-history-element}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 @vindex command-history
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 The list of previous commands using the minibuffer is stored as a Lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 list in the variable @code{command-history}. Each element of the list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 is a Lisp expression which describes one command and its arguments.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 Lisp programs can reexecute a command by feeding the corresponding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 @code{command-history} element to @code{eval}.