From f706c59093645a6306dd907833d597884e69c0ac Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sun, 28 Jan 2018 17:51:35 -0500 Subject: [PATCH] Update manual description of locate-file (Bug#23650) * doc/lispref/files.texi (Locating Files): Add example of predicate when searching for a directory. --- doc/lispref/files.texi | 10 ++++++++++ 1 file changed, 10 insertions(+) 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. -- 2.39.2