From: Noam Postavsky Date: Sun, 28 Jan 2018 22:51:35 +0000 (-0500) Subject: Update manual description of locate-file (Bug#23650) X-Git-Tag: emacs-26.1-rc1~282 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f706c59093645a6306dd907833d597884e69c0ac;p=emacs.git Update manual description of locate-file (Bug#23650) * doc/lispref/files.texi (Locating Files): Add example of predicate when searching for a directory. --- diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index a5d0f9bda39..57428ab40f3 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -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.