emacs-devel
[Top][All Lists]
Advanced

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

Re: master 400df210ce0: Fix last change of 'delete-file'


From: Michael Albinus
Subject: Re: master 400df210ce0: Fix last change of 'delete-file'
Date: Fri, 11 Aug 2023 13:41:01 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii <eliz@gnu.org> writes:

Hi Eli,

> Michael, this is my change, not Eric's.  My question is above: is
> there a requirement that file handlers are called with absolute file
> names?  If so, where is it documented, and why some places, which I
> mentioned above, call file handlers with file names that were not
> passed through expand-file-name?

Ffind_file_name_handler calls fast_string_match (string, filename).
STRING is the car of an entry in file-name-handler-alist, FILENAME is
the file name to be checked.

If the entry in file-name-handler-alist is a regexp for the head of an
absolute file name, the check will fail when FILENAME is relative.

>> > But the same would be true for substitute-in-file-name, for example,
>> > and for directory-file-name, and file-name-as-directory, and several
>> > other primitives, which call Ffind_file_name_handler without calling
>> > expand-file-name before that.

substitute-in-file-name, directory-file-name, file-name-as-directory and
likely more primitives do not support relative file names like
"123". They support file names relative to the remote, like
"/ssh::123". Is this a bug?  Don't know, nobody has protested so
far. But at least it is undocumented.

Other primitives handle this themselves if necessary. Fdelete_file and
other function expand the file name. In Fexpand_file_name itself, we have

--8<---------------cut here---------------start------------->8---
  handler = Ffind_file_name_handler (name, Qexpand_file_name);
  ...
  handler = Ffind_file_name_handler (default_directory, Qexpand_file_name);
--8<---------------cut here---------------end--------------->8---

I wouldn't touch this as it works. Improvements in documentation might
be appreciated.

Best regards, Michael.



reply via email to

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