[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: |
Sat, 12 Aug 2023 13:36:30 +0300 |
> From: Michael Albinus <michael.albinus@gmx.de>
> Cc: rpluim@gmail.com, emacs-devel@gnu.org, esr@thyrsus.com
> Date: Sat, 12 Aug 2023 11:57:19 +0200
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> Hi Eli,
>
> >> > 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).
>
> But this is due to moving delete-file from C core to Lisp. We have the
> same situation with other Lisp functions, which support file name
> handlers and call a C-level function. For example, make-temp-file /
> make-temp-file-internal, make-directory / make-directory-internal,
> delete-directory / delete-directory-internal.
Which is a pity, don't you think?
> > 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?
>
> Perhaps. But in practice, I'm not aware of bug reports about.
It's a ticking time bomb.
> However, we cannot call Fexpand_file_name in Ffind_file_name_handler,
> because expand-file-name supports also file name handlers. This would be
> an infloop. And just binding file-name-handler-alist to nil doesn't
> return the proper result, but a result which is similar only:
We don't need to call expand-file-name in find-file-name-handler,
unless both the file name and default-directory are non-absolute.
> --8<---------------cut here---------------start------------->8---
> (let ((default-directory "/ssh::")
> file-name-handler-alist)
> (expand-file-name "123"))
>
> => "/ssh::/123"
> --8<---------------cut here---------------end--------------->8---
>
> This might be sufficient, but there are cases where we fail. On MS
> Windows, for example, we have
>
> --8<---------------cut here---------------start------------->8---
> (let ((default-directory "/ssh::")
> file-name-handler-alist)
> (expand-file-name "123"))
>
> => "c:/ssh::/123"
> --8<---------------cut here---------------end--------------->8---
Something to fix, I guess. I see no insoluble issues here, FWIW.
- Re: master 400df210ce0: Fix last change of 'delete-file', (continued)
- Re: master 400df210ce0: Fix last change of 'delete-file', Robert Pluim, 2023/08/10
- Re: master 400df210ce0: Fix last change of 'delete-file', Eli Zaretskii, 2023/08/10
- Re: master 400df210ce0: Fix last change of 'delete-file', Michael Albinus, 2023/08/11
- Re: master 400df210ce0: Fix last change of 'delete-file', Eli Zaretskii, 2023/08/11
- Re: master 400df210ce0: Fix last change of 'delete-file', Eli Zaretskii, 2023/08/11
- Re: master 400df210ce0: Fix last change of 'delete-file', Michael Albinus, 2023/08/11
- Re: master 400df210ce0: Fix last change of 'delete-file', Eli Zaretskii, 2023/08/11
- Re: master 400df210ce0: Fix last change of 'delete-file', Michael Albinus, 2023/08/11
- Re: master 400df210ce0: Fix last change of 'delete-file', Eli Zaretskii, 2023/08/11
- Re: master 400df210ce0: Fix last change of 'delete-file', Michael Albinus, 2023/08/12
- Re: master 400df210ce0: Fix last change of 'delete-file',
Eli Zaretskii <=
- Re: master 400df210ce0: Fix last change of 'delete-file', Michael Albinus, 2023/08/12