Update manual description of locate-file (Bug#23650)

* doc/lispref/files.texi (Locating Files): Add example of predicate
when searching for a directory.
This commit is contained in:
Noam Postavsky 2018-01-28 17:51:35 -05:00
parent 16022626ba
commit f706c59093

View file

@ -1541,6 +1541,16 @@ argument. If @var{predicate} is @code{nil} or omitted,
@xref{Kinds of Files}, for other useful predicates, e.g.,
@code{file-executable-p} and @code{file-directory-p}.
This function will normally skip directories, so if you want it to
find directories, make sure the @var{predicate} function returns
@code{dir-ok} for them. For example:
@example
(locate-file "html" '("/var/www" "/srv") nil
(lambda (f) (if (file-directory-p f) 'dir-ok)))
@end example
For compatibility, @var{predicate} can also be one of the symbols
@code{executable}, @code{readable}, @code{writable}, @code{exists}, or
a list of one or more of these symbols.