diff options
| author | Chong Yidong | 2009-03-17 04:54:14 +0000 |
|---|---|---|
| committer | Chong Yidong | 2009-03-17 04:54:14 +0000 |
| commit | b613b1dcc85fbd2578b90644a7216bc1bc7a9f51 (patch) | |
| tree | 7f1bcec1d6335f47d47292e49dd54e7991cf12bc | |
| parent | d897e8eefb228ca2e6817c0ccd69d233ad1a888f (diff) | |
| download | emacs-b613b1dcc85fbd2578b90644a7216bc1bc7a9f51.tar.gz emacs-b613b1dcc85fbd2578b90644a7216bc1bc7a9f51.zip | |
(Basic Completion): Note that read-file-name-completion-ignore-case
and read-buffer-completion-ignore-case can override
completion-ignore-case.
(Minibuffer Completion): Document completing-read changes.
(Completion Commands): Avoid mentioning partial completion mode.
Document minibuffer-completion-confirm changes, and
minibuffer-confirm-exit-commands.
(High-Level Completion): Document new require-match behavior for
read-buffer. Document read-buffer-completion-ignore-case.
(Reading File Names): Document new require-match behavior for
read-file-name.
| -rw-r--r-- | doc/lispref/minibuf.texi | 119 |
1 files changed, 73 insertions, 46 deletions
diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index a03e8036a93..cb600990f57 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi | |||
| @@ -824,7 +824,11 @@ it returns, @code{test-completion} returns in turn. | |||
| 824 | 824 | ||
| 825 | @defvar completion-ignore-case | 825 | @defvar completion-ignore-case |
| 826 | If the value of this variable is non-@code{nil}, Emacs does not | 826 | If the value of this variable is non-@code{nil}, Emacs does not |
| 827 | consider case significant in completion. | 827 | consider case significant in completion. Note, however, that this |
| 828 | variable is overridden by @code{read-file-name-completion-ignore-case} | ||
| 829 | within @code{read-file-name} (@pxref{Reading File Names}), and by | ||
| 830 | @code{read-buffer-completion-ignore-case} within @code{read-buffer} | ||
| 831 | (@pxref{High-Level Completion}). | ||
| 828 | @end defvar | 832 | @end defvar |
| 829 | 833 | ||
| 830 | @defvar completion-regexp-list | 834 | @defvar completion-regexp-list |
| @@ -871,15 +875,33 @@ Some of these commands also call @code{test-completion}. Thus, if | |||
| 871 | @var{collection} and @code{completion-ignore-case}. @xref{Definition | 875 | @var{collection} and @code{completion-ignore-case}. @xref{Definition |
| 872 | of test-completion}. | 876 | of test-completion}. |
| 873 | 877 | ||
| 874 | If @var{require-match} is @code{nil}, the exit commands work regardless | 878 | The value of the optional argument @var{require-match} determines how |
| 875 | of the input in the minibuffer. If @var{require-match} is @code{t}, the | 879 | the user may exit the minibuffer: |
| 876 | usual minibuffer exit commands won't exit unless the input completes to | 880 | |
| 877 | an element of @var{collection}. If @var{require-match} is | 881 | @itemize @bullet |
| 878 | @code{confirm-only}, the user can exit with any input, but she will | 882 | @item |
| 879 | be asked for a confirmation if the input is not an element of | 883 | If @code{nil}, the usual minibuffer exit commands work regardless of |
| 880 | @var{collection}. Any other value of @var{require-match} behaves like | 884 | the input in the minibuffer. |
| 881 | @code{t}, except that the exit commands won't exit if it does non-null | 885 | |
| 882 | completion. | 886 | @item |
| 887 | If @code{t}, the usual minibuffer exit commands won't exit unless the | ||
| 888 | input completes to an element of @var{collection}. | ||
| 889 | |||
| 890 | @item | ||
| 891 | If @code{confirm}, the user can exit with any input, but is asked for | ||
| 892 | confirmation if the input is not an element of @var{collection}. | ||
| 893 | |||
| 894 | @item | ||
| 895 | If @code{confirm-after-completion}, the user can exit with any input, | ||
| 896 | but is asked for confirmation if the preceding command was a | ||
| 897 | completion command (i.e., one of the commands in | ||
| 898 | @code{minibuffer-confirm-exit-commands}) and the resulting input is | ||
| 899 | not an element of @var{collection}. @xref{Completion Commands}. | ||
| 900 | |||
| 901 | @item | ||
| 902 | Any other value of @var{require-match} behaves like @code{t}, except | ||
| 903 | that the exit commands won't exit if it performs completion. | ||
| 904 | @end itemize | ||
| 883 | 905 | ||
| 884 | However, empty input is always permitted, regardless of the value of | 906 | However, empty input is always permitted, regardless of the value of |
| 885 | @var{require-match}; in that case, @code{completing-read} returns the | 907 | @var{require-match}; in that case, @code{completing-read} returns the |
| @@ -948,12 +970,7 @@ They are described in the following section. | |||
| 948 | @subsection Minibuffer Commands that Do Completion | 970 | @subsection Minibuffer Commands that Do Completion |
| 949 | 971 | ||
| 950 | This section describes the keymaps, commands and user options used | 972 | This section describes the keymaps, commands and user options used |
| 951 | in the minibuffer to do completion. The description refers to the | 973 | in the minibuffer to do completion. |
| 952 | situation when Partial Completion mode is disabled (as it is by | ||
| 953 | default). When enabled, this minor mode uses its own alternatives to | ||
| 954 | some of the commands described below. @xref{Completion Options,,, | ||
| 955 | emacs, The GNU Emacs Manual}, for a short description of Partial | ||
| 956 | Completion mode. | ||
| 957 | 974 | ||
| 958 | @defvar minibuffer-completion-table | 975 | @defvar minibuffer-completion-table |
| 959 | The value of this variable is the collection used for completion in | 976 | The value of this variable is the collection used for completion in |
| @@ -969,10 +986,25 @@ minibuffer completion functions. | |||
| 969 | @end defvar | 986 | @end defvar |
| 970 | 987 | ||
| 971 | @defvar minibuffer-completion-confirm | 988 | @defvar minibuffer-completion-confirm |
| 972 | When the value of this variable is non-@code{nil}, Emacs asks for | 989 | This variable determines whether Emacs asks for confirmation before |
| 973 | confirmation of a completion before exiting the minibuffer. | 990 | exiting the minibuffer; @code{completing-read} binds this variable, |
| 974 | @code{completing-read} binds this variable, and the function | 991 | and the function @code{minibuffer-complete-and-exit} checks the value |
| 975 | @code{minibuffer-complete-and-exit} checks the value before exiting. | 992 | before exiting. If the value is @code{nil}, confirmation is not |
| 993 | required. If the value is @code{confirm}, the user may exit with an | ||
| 994 | input that is not a valid completion alternative, but Emacs asks for | ||
| 995 | confirmation. If the value is @code{confirm-after-completion}, the | ||
| 996 | user may exit with an input that is not a valid completion | ||
| 997 | alternative, but Emacs asks for confirmation if the user submitted the | ||
| 998 | input right after any of the completion commands in | ||
| 999 | @code{minibuffer-confirm-exit-commands}. | ||
| 1000 | @end defvar | ||
| 1001 | |||
| 1002 | @defvar minibuffer-confirm-exit-commands | ||
| 1003 | This variable holds a list of commands that cause Emacs to ask for | ||
| 1004 | confirmation before exiting the minibuffer, if the @var{require-match} | ||
| 1005 | argument to @code{completing-read} is @code{confirm-after-completion}. | ||
| 1006 | The confirmation is requested if the user attempts to exit the | ||
| 1007 | minibuffer immediately after calling any command in this list. | ||
| 976 | @end defvar | 1008 | @end defvar |
| 977 | 1009 | ||
| 978 | @deffn Command minibuffer-complete-word | 1010 | @deffn Command minibuffer-complete-word |
| @@ -1113,7 +1145,7 @@ Lisp function. When possible, do all minibuffer input as part of | |||
| 1113 | reading the arguments for a command, in the @code{interactive} | 1145 | reading the arguments for a command, in the @code{interactive} |
| 1114 | specification. @xref{Defining Commands}. | 1146 | specification. @xref{Defining Commands}. |
| 1115 | 1147 | ||
| 1116 | @defun read-buffer prompt &optional default existing | 1148 | @defun read-buffer prompt &optional default require-match |
| 1117 | This function reads the name of a buffer and returns it as a string. | 1149 | This function reads the name of a buffer and returns it as a string. |
| 1118 | The argument @var{default} is the default name to use, the value to | 1150 | The argument @var{default} is the default name to use, the value to |
| 1119 | return if the user exits with an empty minibuffer. If non-@code{nil}, | 1151 | return if the user exits with an empty minibuffer. If non-@code{nil}, |
| @@ -1127,17 +1159,12 @@ space. If @var{default} is non-@code{nil}, the function inserts it in | |||
| 1127 | @var{prompt} before the colon to follow the convention for reading from | 1159 | @var{prompt} before the colon to follow the convention for reading from |
| 1128 | the minibuffer with a default value (@pxref{Programming Tips}). | 1160 | the minibuffer with a default value (@pxref{Programming Tips}). |
| 1129 | 1161 | ||
| 1130 | If @var{existing} is non-@code{nil}, then the name specified must be | 1162 | The optional argument @var{require-match} has the same meaning as in |
| 1131 | that of an existing buffer. The usual commands to exit the minibuffer | 1163 | @code{completing-read}. @xref{Minibuffer Completion}. |
| 1132 | do not exit if the text is not valid, and @key{RET} does completion to | ||
| 1133 | attempt to find a valid name. If @var{existing} is neither @code{nil} | ||
| 1134 | nor @code{t}, confirmation is required after completion. (However, | ||
| 1135 | @var{default} is not checked for validity; it is returned, whatever it | ||
| 1136 | is, if the user exits with the minibuffer empty.) | ||
| 1137 | 1164 | ||
| 1138 | In the following example, the user enters @samp{minibuffer.t}, and | 1165 | In the following example, the user enters @samp{minibuffer.t}, and |
| 1139 | then types @key{RET}. The argument @var{existing} is @code{t}, and the | 1166 | then types @key{RET}. The argument @var{require-match} is @code{t}, |
| 1140 | only buffer name starting with the given input is | 1167 | and the only buffer name starting with the given input is |
| 1141 | @samp{minibuffer.texi}, so that name is the value. | 1168 | @samp{minibuffer.texi}, so that name is the value. |
| 1142 | 1169 | ||
| 1143 | @example | 1170 | @example |
| @@ -1168,6 +1195,11 @@ that call @code{read-buffer} to read a buffer name will actually use the | |||
| 1168 | @code{iswitchb} package to read it. | 1195 | @code{iswitchb} package to read it. |
| 1169 | @end defvar | 1196 | @end defvar |
| 1170 | 1197 | ||
| 1198 | @defvar read-buffer-completion-ignore-case | ||
| 1199 | If this variable is non-@code{nil}, @code{read-buffer} ignores case | ||
| 1200 | when performing completion. | ||
| 1201 | @end defvar | ||
| 1202 | |||
| 1171 | @defun read-command prompt &optional default | 1203 | @defun read-command prompt &optional default |
| 1172 | This function reads the name of a command and returns it as a Lisp | 1204 | This function reads the name of a command and returns it as a Lisp |
| 1173 | symbol. The argument @var{prompt} is used as in | 1205 | symbol. The argument @var{prompt} is used as in |
| @@ -1302,23 +1334,18 @@ and @code{read-input-method-name}, in @ref{Input Methods}. | |||
| 1302 | for reading file names and shell commands. They provide special | 1334 | for reading file names and shell commands. They provide special |
| 1303 | features including automatic insertion of the default directory. | 1335 | features including automatic insertion of the default directory. |
| 1304 | 1336 | ||
| 1305 | @defun read-file-name prompt &optional directory default existing initial predicate | 1337 | @defun read-file-name prompt &optional directory default require-match initial predicate |
| 1306 | This function reads a file name in the minibuffer, prompting with | 1338 | This function reads a file name in the minibuffer, prompting with |
| 1307 | @var{prompt} and providing completion. | 1339 | @var{prompt} and providing completion. |
| 1308 | 1340 | ||
| 1309 | If @var{existing} is non-@code{nil}, then the user must specify the name | 1341 | The optional argument @var{require-match} has the same meaning as in |
| 1310 | of an existing file; @key{RET} performs completion to make the name | 1342 | @code{completing-read}. @xref{Minibuffer Completion}. |
| 1311 | valid if possible, and then refuses to exit if it is not valid. If the | ||
| 1312 | value of @var{existing} is neither @code{nil} nor @code{t}, then | ||
| 1313 | @key{RET} also requires confirmation after completion. If | ||
| 1314 | @var{existing} is @code{nil}, then the name of a nonexistent file is | ||
| 1315 | acceptable. | ||
| 1316 | 1343 | ||
| 1317 | @code{read-file-name} uses | 1344 | @code{read-file-name} uses |
| 1318 | @code{minibuffer-local-filename-completion-map} as the keymap if | 1345 | @code{minibuffer-local-filename-completion-map} as the keymap if |
| 1319 | @var{existing} is @code{nil}, and uses | 1346 | @var{require-match} is @code{nil}, and uses |
| 1320 | @code{minibuffer-local-filename-must-match-map} if @var{existing} is | 1347 | @code{minibuffer-local-filename-must-match-map} if @var{require-match} |
| 1321 | non-@code{nil}. @xref{Completion Commands}. | 1348 | is non-@code{nil}. @xref{Completion Commands}. |
| 1322 | 1349 | ||
| 1323 | The argument @var{directory} specifies the directory to use for | 1350 | The argument @var{directory} specifies the directory to use for |
| 1324 | completion of relative file names. It should be an absolute directory | 1351 | completion of relative file names. It should be an absolute directory |
| @@ -1341,7 +1368,7 @@ contents that @code{read-file-name} inserted initially. The initial | |||
| 1341 | minibuffer contents are always non-empty if | 1368 | minibuffer contents are always non-empty if |
| 1342 | @code{insert-default-directory} is non-@code{nil}, as it is by | 1369 | @code{insert-default-directory} is non-@code{nil}, as it is by |
| 1343 | default. @var{default} is not checked for validity, regardless of the | 1370 | default. @var{default} is not checked for validity, regardless of the |
| 1344 | value of @var{existing}. However, if @var{existing} is | 1371 | value of @var{require-match}. However, if @var{require-match} is |
| 1345 | non-@code{nil}, the initial minibuffer contents should be a valid file | 1372 | non-@code{nil}, the initial minibuffer contents should be a valid file |
| 1346 | (or directory) name. Otherwise @code{read-file-name} attempts | 1373 | (or directory) name. Otherwise @code{read-file-name} attempts |
| 1347 | completion if the user exits without any editing, and does not return | 1374 | completion if the user exits without any editing, and does not return |
| @@ -1361,9 +1388,9 @@ types @key{RET} without any editing, @code{read-file-name} simply | |||
| 1361 | returns the pre-inserted contents of the minibuffer. | 1388 | returns the pre-inserted contents of the minibuffer. |
| 1362 | 1389 | ||
| 1363 | If the user types @key{RET} in an empty minibuffer, this function | 1390 | If the user types @key{RET} in an empty minibuffer, this function |
| 1364 | returns an empty string, regardless of the value of @var{existing}. | 1391 | returns an empty string, regardless of the value of |
| 1365 | This is, for instance, how the user can make the current buffer visit | 1392 | @var{require-match}. This is, for instance, how the user can make the |
| 1366 | no file using @code{M-x set-visited-file-name}. | 1393 | current buffer visit no file using @code{M-x set-visited-file-name}. |
| 1367 | 1394 | ||
| 1368 | If @var{predicate} is non-@code{nil}, it specifies a function of one | 1395 | If @var{predicate} is non-@code{nil}, it specifies a function of one |
| 1369 | argument that decides which file names are acceptable completion | 1396 | argument that decides which file names are acceptable completion |
| @@ -1420,7 +1447,7 @@ If this variable is non-@code{nil}, @code{read-file-name} ignores case | |||
| 1420 | when performing completion. | 1447 | when performing completion. |
| 1421 | @end defvar | 1448 | @end defvar |
| 1422 | 1449 | ||
| 1423 | @defun read-directory-name prompt &optional directory default existing initial | 1450 | @defun read-directory-name prompt &optional directory default require-match initial |
| 1424 | This function is like @code{read-file-name} but allows only directory | 1451 | This function is like @code{read-file-name} but allows only directory |
| 1425 | names as completion possibilities. | 1452 | names as completion possibilities. |
| 1426 | 1453 | ||