bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#66542: Fix: locate-dominating-file predicate should receive dir not


From: Eli Zaretskii
Subject: bug#66542: Fix: locate-dominating-file predicate should receive dir not file
Date: Sat, 14 Oct 2023 18:46:26 +0300

> From: dalanicolai <dalanicolai@gmail.com>
> Date: Sat, 14 Oct 2023 17:11:18 +0200
> 
> The docstring of 'locate-dominating-file' mentions that its NAME argument
> should be a dir, but currently it simply receives the FILE
> argument. Therefore, using the function e.g. with the following predicate for 
> NAME
> 
> (lambda (dir)
> (seq-filter (apply-partially #'string-match-p "paint")
> (directory-files
> dir)))
> 
> to check if a directory contains a file regexp-matching 'paint', throws
> an error:
> 
> (file-error "Opening directory" "Not a directory" "/home/...")
> 
> This patch simply wraps the FILE argument in the (funcall NAME FILE) with
> a 'file-name-directory' thereby fixing the function.

Sorry, I don't understand: the return value of file-name-directory is
not identical to its argument when the argument is a directory, so
this patch might change the behavior.  Or what am I missing?

In addition, I don't think I understand the problem you are trying to
solve.  Could you please describe the problem more completely, by
telling when and how was locate-dominating-file called with the name
of a file that is not a directory?





reply via email to

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