Commit 1c7cdff5 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(Reading File Names): read-file-name has new arg PREDICATE.

New function read-directory-name.
parent d5c99c9e
...@@ -1083,7 +1083,7 @@ predicate @code{user-variable-p} instead of @code{commandp}: ...@@ -1083,7 +1083,7 @@ predicate @code{user-variable-p} instead of @code{commandp}:
file name. It provides special features including automatic insertion file name. It provides special features including automatic insertion
of the default directory. of the default directory.
@defun read-file-name prompt &optional directory default existing initial @defun read-file-name prompt &optional directory default existing initial predicate
This function reads a file name in the minibuffer, prompting with This function reads a file name in the minibuffer, prompting with
@var{prompt} and providing completion. If @var{default} is @var{prompt} and providing completion. If @var{default} is
non-@code{nil}, then the function returns @var{default} if the user just non-@code{nil}, then the function returns @var{default} if the user just
...@@ -1112,6 +1112,11 @@ case, point goes at the beginning of @var{initial}. The default for ...@@ -1112,6 +1112,11 @@ case, point goes at the beginning of @var{initial}. The default for
@var{initial} does, try the command @kbd{C-x C-v}. @strong{Note:} we @var{initial} does, try the command @kbd{C-x C-v}. @strong{Note:} we
recommend using @var{default} rather than @var{initial} in most cases. recommend using @var{default} rather than @var{initial} in most cases.
If @var{predicate} is non-@code{nil}, it specifies a function of one
argument that decides which file names are acceptable completion
possibilities. A file name is an acceptable value if @var{predicate}
returns non-@code{nil} for it.
Here is an example: Here is an example:
@example @example
...@@ -1146,6 +1151,11 @@ If the user types @key{RET}, @code{read-file-name} returns the file name ...@@ -1146,6 +1151,11 @@ If the user types @key{RET}, @code{read-file-name} returns the file name
as the string @code{"/gp/gnu/elisp/manual.texi"}. as the string @code{"/gp/gnu/elisp/manual.texi"}.
@end defun @end defun
@defun read-directory-name prompt &optional directory default existing initial
This function is like @code{read-file-name} but allows only directory
names as completion possibilities.
@end defun
@defopt insert-default-directory @defopt insert-default-directory
This variable is used by @code{read-file-name}. Its value controls This variable is used by @code{read-file-name}. Its value controls
whether @code{read-file-name} starts by placing the name of the default whether @code{read-file-name} starts by placing the name of the default
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment