[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

From: Nikolay Kudryavtsev
Subject: bug#23650: Use of locate-file for directories is underdocumented
Date: Mon, 30 May 2016 01:44:11 +0300
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0


Let's say I have a list of folders A, B, C. I want to find which one of them contains subfolder D.

My first idea was using locate-file. While doing so I've found that the Elisp reference for it is incomplete and confusing:

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)))

Best Regards,
Nikolay Kudryavtsev

reply via email to

[Prev in Thread] Current Thread [Next in Thread]