aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2009-03-17 04:54:14 +0000
committerChong Yidong2009-03-17 04:54:14 +0000
commitb613b1dcc85fbd2578b90644a7216bc1bc7a9f51 (patch)
tree7f1bcec1d6335f47d47292e49dd54e7991cf12bc
parentd897e8eefb228ca2e6817c0ccd69d233ad1a888f (diff)
downloademacs-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.texi119
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
826If the value of this variable is non-@code{nil}, Emacs does not 826If the value of this variable is non-@code{nil}, Emacs does not
827consider case significant in completion. 827consider case significant in completion. Note, however, that this
828variable is overridden by @code{read-file-name-completion-ignore-case}
829within @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
872of test-completion}. 876of test-completion}.
873 877
874If @var{require-match} is @code{nil}, the exit commands work regardless 878The value of the optional argument @var{require-match} determines how
875of the input in the minibuffer. If @var{require-match} is @code{t}, the 879the user may exit the minibuffer:
876usual minibuffer exit commands won't exit unless the input completes to 880
877an 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
879be asked for a confirmation if the input is not an element of 883If @code{nil}, the usual minibuffer exit commands work regardless of
880@var{collection}. Any other value of @var{require-match} behaves like 884the input in the minibuffer.
881@code{t}, except that the exit commands won't exit if it does non-null 885
882completion. 886@item
887If @code{t}, the usual minibuffer exit commands won't exit unless the
888input completes to an element of @var{collection}.
889
890@item
891If @code{confirm}, the user can exit with any input, but is asked for
892confirmation if the input is not an element of @var{collection}.
893
894@item
895If @code{confirm-after-completion}, the user can exit with any input,
896but is asked for confirmation if the preceding command was a
897completion command (i.e., one of the commands in
898@code{minibuffer-confirm-exit-commands}) and the resulting input is
899not an element of @var{collection}. @xref{Completion Commands}.
900
901@item
902Any other value of @var{require-match} behaves like @code{t}, except
903that the exit commands won't exit if it performs completion.
904@end itemize
883 905
884However, empty input is always permitted, regardless of the value of 906However, 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
951in the minibuffer to do completion. The description refers to the 973in the minibuffer to do completion.
952situation when Partial Completion mode is disabled (as it is by
953default). When enabled, this minor mode uses its own alternatives to
954some of the commands described below. @xref{Completion Options,,,
955emacs, The GNU Emacs Manual}, for a short description of Partial
956Completion mode.
957 974
958@defvar minibuffer-completion-table 975@defvar minibuffer-completion-table
959The value of this variable is the collection used for completion in 976The 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
972When the value of this variable is non-@code{nil}, Emacs asks for 989This variable determines whether Emacs asks for confirmation before
973confirmation of a completion before exiting the minibuffer. 990exiting the minibuffer; @code{completing-read} binds this variable,
974@code{completing-read} binds this variable, and the function 991and the function @code{minibuffer-complete-and-exit} checks the value
975@code{minibuffer-complete-and-exit} checks the value before exiting. 992before exiting. If the value is @code{nil}, confirmation is not
993required. If the value is @code{confirm}, the user may exit with an
994input that is not a valid completion alternative, but Emacs asks for
995confirmation. If the value is @code{confirm-after-completion}, the
996user may exit with an input that is not a valid completion
997alternative, but Emacs asks for confirmation if the user submitted the
998input right after any of the completion commands in
999@code{minibuffer-confirm-exit-commands}.
1000@end defvar
1001
1002@defvar minibuffer-confirm-exit-commands
1003This variable holds a list of commands that cause Emacs to ask for
1004confirmation before exiting the minibuffer, if the @var{require-match}
1005argument to @code{completing-read} is @code{confirm-after-completion}.
1006The confirmation is requested if the user attempts to exit the
1007minibuffer 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
1113reading the arguments for a command, in the @code{interactive} 1145reading the arguments for a command, in the @code{interactive}
1114specification. @xref{Defining Commands}. 1146specification. @xref{Defining Commands}.
1115 1147
1116@defun read-buffer prompt &optional default existing 1148@defun read-buffer prompt &optional default require-match
1117This function reads the name of a buffer and returns it as a string. 1149This function reads the name of a buffer and returns it as a string.
1118The argument @var{default} is the default name to use, the value to 1150The argument @var{default} is the default name to use, the value to
1119return if the user exits with an empty minibuffer. If non-@code{nil}, 1151return 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
1128the minibuffer with a default value (@pxref{Programming Tips}). 1160the minibuffer with a default value (@pxref{Programming Tips}).
1129 1161
1130If @var{existing} is non-@code{nil}, then the name specified must be 1162The optional argument @var{require-match} has the same meaning as in
1131that of an existing buffer. The usual commands to exit the minibuffer 1163@code{completing-read}. @xref{Minibuffer Completion}.
1132do not exit if the text is not valid, and @key{RET} does completion to
1133attempt to find a valid name. If @var{existing} is neither @code{nil}
1134nor @code{t}, confirmation is required after completion. (However,
1135@var{default} is not checked for validity; it is returned, whatever it
1136is, if the user exits with the minibuffer empty.)
1137 1164
1138In the following example, the user enters @samp{minibuffer.t}, and 1165In the following example, the user enters @samp{minibuffer.t}, and
1139then types @key{RET}. The argument @var{existing} is @code{t}, and the 1166then types @key{RET}. The argument @var{require-match} is @code{t},
1140only buffer name starting with the given input is 1167and 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
1199If this variable is non-@code{nil}, @code{read-buffer} ignores case
1200when performing completion.
1201@end defvar
1202
1171@defun read-command prompt &optional default 1203@defun read-command prompt &optional default
1172This function reads the name of a command and returns it as a Lisp 1204This function reads the name of a command and returns it as a Lisp
1173symbol. The argument @var{prompt} is used as in 1205symbol. The argument @var{prompt} is used as in
@@ -1302,23 +1334,18 @@ and @code{read-input-method-name}, in @ref{Input Methods}.
1302for reading file names and shell commands. They provide special 1334for reading file names and shell commands. They provide special
1303features including automatic insertion of the default directory. 1335features 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
1306This function reads a file name in the minibuffer, prompting with 1338This function reads a file name in the minibuffer, prompting with
1307@var{prompt} and providing completion. 1339@var{prompt} and providing completion.
1308 1340
1309If @var{existing} is non-@code{nil}, then the user must specify the name 1341The optional argument @var{require-match} has the same meaning as in
1310of an existing file; @key{RET} performs completion to make the name 1342@code{completing-read}. @xref{Minibuffer Completion}.
1311valid if possible, and then refuses to exit if it is not valid. If the
1312value 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
1315acceptable.
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}
1321non-@code{nil}. @xref{Completion Commands}. 1348is non-@code{nil}. @xref{Completion Commands}.
1322 1349
1323The argument @var{directory} specifies the directory to use for 1350The argument @var{directory} specifies the directory to use for
1324completion of relative file names. It should be an absolute directory 1351completion of relative file names. It should be an absolute directory
@@ -1341,7 +1368,7 @@ contents that @code{read-file-name} inserted initially. The initial
1341minibuffer contents are always non-empty if 1368minibuffer 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
1343default. @var{default} is not checked for validity, regardless of the 1370default. @var{default} is not checked for validity, regardless of the
1344value of @var{existing}. However, if @var{existing} is 1371value of @var{require-match}. However, if @var{require-match} is
1345non-@code{nil}, the initial minibuffer contents should be a valid file 1372non-@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
1347completion if the user exits without any editing, and does not return 1374completion 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
1361returns the pre-inserted contents of the minibuffer. 1388returns the pre-inserted contents of the minibuffer.
1362 1389
1363If the user types @key{RET} in an empty minibuffer, this function 1390If the user types @key{RET} in an empty minibuffer, this function
1364returns an empty string, regardless of the value of @var{existing}. 1391returns an empty string, regardless of the value of
1365This 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
1366no file using @code{M-x set-visited-file-name}. 1393current buffer visit no file using @code{M-x set-visited-file-name}.
1367 1394
1368If @var{predicate} is non-@code{nil}, it specifies a function of one 1395If @var{predicate} is non-@code{nil}, it specifies a function of one
1369argument that decides which file names are acceptable completion 1396argument 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
1420when performing completion. 1447when 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
1424This function is like @code{read-file-name} but allows only directory 1451This function is like @code{read-file-name} but allows only directory
1425names as completion possibilities. 1452names as completion possibilities.
1426 1453