Subject: Re: bug#23650: Use of locate-file for directories is underdocumented

From: Noam Postavsky <[email-masked]>
Date: Tue, 30 Jan 2018 22:40:59 -0500

tags 23650 fixed
close 23650 26.1
quit

Nikolay Kudryavtsev <[email-masked]> writes:

> 1. According to the docstring it would only return a directory if
> PREDICATE returns 'dir-ok. This is not mentioned in the Elisp
> reference.
>
> 2. The reference suggests file-directory-p as a useful predicate and
> this would fail due to 1.
>
> 3. It's probably a good idea to mention that there are no bundled
> predicates that return dir-ok, and suggest to use a lamda like this:
> (lambda (f) (and (file-directory-p f) 'dir-ok)) as a PREDICATE.
>
>
> Here's a working example, just in case:
>
> (locate-file "Git" '("c:/Program Files/") nil (lambda (f) (and
> (file-directory-p f) 'dir-ok)))

Added a clarifiction and a similar example (though not one with w32
path) in emacs-26.

[1: f706c59093]: 2018-01-30 22:14:02 -0500
  Update manual description of locate-file (Bug#23650)
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=f706c59093645a6306dd907833d597884e69c0ac