unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: dalanicolai <dalanicolai@gmail.com>
Cc: 66542@debbugs.gnu.org
Subject: bug#66542: Fix: locate-dominating-file predicate should receive dir not file
Date: Sat, 14 Oct 2023 18:46:26 +0300	[thread overview]
Message-ID: <83mswlqka5.fsf@gnu.org> (raw)
In-Reply-To: <CACJP=3=OVLMxY0YKceXD+yNb36dJt7hr6kOA9YquHGFvt8e8Vw@mail.gmail.com> (message from dalanicolai on Sat, 14 Oct 2023 17:11:18 +0200)

> 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	other threads:[~2023-10-14 15:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-14 15:11 bug#66542: Fix: locate-dominating-file predicate should receive dir not file dalanicolai
2023-10-14 15:46 ` Eli Zaretskii [this message]
2023-10-21 15:39   ` dalanicolai
2023-10-25 13:15     ` Eli Zaretskii
2023-10-26 13:27       ` dalanicolai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83mswlqka5.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=66542@debbugs.gnu.org \
    --cc=dalanicolai@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).