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: Eli Zaretskii
Subject: Re: master 400df210ce0: Fix last change of 'delete-file'
Date: Fri, 11 Aug 2023 20:47:10 +0300

> From: Michael Albinus <michael.albinus@gmx.de>
> Cc: rpluim@gmail.com,  emacs-devel@gnu.org,  esr@thyrsus.com
> Date: Fri, 11 Aug 2023 19:24:25 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> Hi Eli,
> 
> > Primitives indeed _must_ call expand-file-name.  And expand-file-name
> > does that with default-directory because it accepts a directory as its
> > 2nd argument, and that argument defaults to default-directory.
> 
> Do you want two different versions of find-file-name-handler? One used
> for primitives in C core which doesn't apply expand-file-name, and
> another version for file operations in Lisp?

No, I mean single one that serves both.

> > The addition of expand-file-name to delete-file made that function a
> > bit slower, and for local files that is a net loss.  We should extend
> > instead find-file-name-handler to work for non-absolute file names to
> > avoid this overhead.
> 
> It is not a recent addition, it has been there for ages. In Fdelete_file.

I'm talking about the situation on master now, after delete-file was
split into two parts.  After my change today, delete-file calls
expand-file-name (because find-file-name-handler needs that), and then
delete-file-internal calls expand-file-name again (because every
primitive must).

> > Indeed, the fact that find-file-name-handler needs an absolute file
> > name is never mentioned anywhere in the documentation.  It is strange
> > this didn't pop up earlier.
> 
> find-file-name-handler does not need an absolute file name in
> general. Several handlers are invoked based on the file name
> extensions. It are the remote file names which require absolute file
> names.

A caller of find-file-name-handler cannot (and should not) know which
parts of the file name the handlers look at.

> If we add expand-file-name for cases it isn't applied yet, Emacs might
> become slower. And perhaps we introduce new faults by this, because
> everybody has arranged with the current behavior.

But the situation now is bad already: if I call
file-name-as-directory, for example, with a relative file name in a
remote directory, the handler is not invoked.  Isn't that a bug?



reply via email to

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