GNU bug report logs - #23650
Use of locate-file for directories is underdocumented

Previous Next

Package: emacs;

Reported by: Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com>

Date: Sun, 29 May 2016 22:45:02 UTC

Severity: minor

Tags: fixed

Fixed in version 26.1

Done: Noam Postavsky <npostavs <at> users.sourceforge.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com>
Cc: 23650 <at> debbugs.gnu.org
Subject: bug#23650: Use of locate-file for directories is underdocumented
Date: Tue, 30 Jan 2018 22:40:59 -0500
tags 23650 fixed
close 23650 26.1
quit

Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com> 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




This bug report was last modified 7 years and 116 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.