all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: master 10a7615b5d4: Separate filename-deletion mechanism from policy.
       [not found] ` <20230806133211.6301AC038BE@vcs2.savannah.gnu.org>
@ 2023-08-06 13:37   ` Po Lu
  2023-08-06 14:12     ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Po Lu @ 2023-08-06 13:37 UTC (permalink / raw)
  To: emacs-devel; +Cc: Eric S. Raymond

"Eric S. Raymond" <esr@thyrsus.com> writes:

>     This is a pure refactoring step, delete-file's behavior is
>     unchanged. But the C core is a little simpler now.
> ---
>  lisp/files.el | 20 ++++++++++++++++++++
>  src/fileio.c  | 40 +++++++++-------------------------------
>  2 files changed, 29 insertions(+), 31 deletions(-)
>
> diff --git a/lisp/files.el b/lisp/files.el
> index f8867432000..84a8c308b09 100644
> --- a/lisp/files.el
> +++ b/lisp/files.el
> @@ -6352,6 +6352,26 @@ non-nil and if FN fails due to a missing file or directory."
>        (apply fn args)
>      (file-missing (or no-such (signal (car err) (cdr err))))))
>  
> +(defun delete-file (filename &optional trash)
> +  "Delete file named FILENAME.  If it is a symlink, remove the symlink.
> +If file has multiple names, it continues to exist with the other names.q
                                                                          ^
Typo alert!

Thanks.  While I'm not enthusiastic about moving functions from C to
Lisp, others seem to appreciate the gesture, so I won't mention this
subject now.

However,

> branch: master
> commit 10a7615b5d45bcd909bb03d67423b337dfe93b1e
> Author: Eric S. Raymond <esr@thyrsus.com>
> Commit: Eric S. Raymond <esr@thyrsus.com>
>
>     Separate filename-deletion mechanism from policy.
>     
>     src/fileio.c: (delete-file-internal) Renamed from delete-file,
>                   parallel to delete-directory-internal; policy
>                   code moved to Lisp.
>     src/files.el: (delete-file) New function, holds policy logic.
>                   calls delete-file-internal.

is incorrect, since our ChangeLog generator expects the entries to be
formatted like so:

* src/fileio.c (delete-file-internal): Renamed from delete-file,
its counterpart being delete-directory-internal; policy code
moved to Lisp.

* src/files.el (delete-file): ...



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: master 10a7615b5d4: Separate filename-deletion mechanism from policy.
  2023-08-06 13:37   ` master 10a7615b5d4: Separate filename-deletion mechanism from policy Po Lu
@ 2023-08-06 14:12     ` Eli Zaretskii
  2023-08-07 15:21       ` Andrea Corallo
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2023-08-06 14:12 UTC (permalink / raw)
  To: Po Lu, Andrea Corallo; +Cc: emacs-devel, esr

> From: Po Lu <luangruo@yahoo.com>
> Cc: "Eric S. Raymond" <esr@thyrsus.com>
> Date: Sun, 06 Aug 2023 21:37:21 +0800
> 
> "Eric S. Raymond" <esr@thyrsus.com> writes:
> 
> >     This is a pure refactoring step, delete-file's behavior is
> >     unchanged. But the C core is a little simpler now.
> > ---
> >  lisp/files.el | 20 ++++++++++++++++++++
> >  src/fileio.c  | 40 +++++++++-------------------------------
> >  2 files changed, 29 insertions(+), 31 deletions(-)
> >
> > diff --git a/lisp/files.el b/lisp/files.el
> > index f8867432000..84a8c308b09 100644
> > --- a/lisp/files.el
> > +++ b/lisp/files.el
> > @@ -6352,6 +6352,26 @@ non-nil and if FN fails due to a missing file or directory."
> >        (apply fn args)
> >      (file-missing (or no-such (signal (car err) (cdr err))))))
> >  
> > +(defun delete-file (filename &optional trash)
> > +  "Delete file named FILENAME.  If it is a symlink, remove the symlink.
> > +If file has multiple names, it continues to exist with the other names.q
>                                                                           ^
> Typo alert!
> 
> Thanks.  While I'm not enthusiastic about moving functions from C to
> Lisp, others seem to appreciate the gesture, so I won't mention this
> subject now.

This kind of changes should have been discussed before it was
installed.  There are several issues I can see here:

  . delete-file-internal must call expand-file-name on its argument,
    as all primitives that interface to the filesystem must; I fixed
    that;
  . Emacs will now be unable to call delete-file or rename-file during
    loadup, until files.el is loaded -- not sure if this is a problem,
    but I guess we will see;
  . the changeset failed to adjust internal_delete_file, which still
    called Fdelete_file; I fixed that (I hope, see below)

Andrea, please take a look at the last bullet above: I made
internal_delete_file call Fdelete_file_internal, which means it no
longer supports remote files.  If that is a problem, we should call
Qdelete_file there, but then I wonder whether calling Lisp at that
place, even though delete-file is preloaded, can cause any trouble?
If there's any doubt this will work, I'd rather revert this whole
changeset, as this is a delicate place in Emacs, and I'd hate to break
it.

> However,
> 
> > branch: master
> > commit 10a7615b5d45bcd909bb03d67423b337dfe93b1e
> > Author: Eric S. Raymond <esr@thyrsus.com>
> > Commit: Eric S. Raymond <esr@thyrsus.com>
> >
> >     Separate filename-deletion mechanism from policy.
> >     
> >     src/fileio.c: (delete-file-internal) Renamed from delete-file,
> >                   parallel to delete-directory-internal; policy
> >                   code moved to Lisp.
> >     src/files.el: (delete-file) New function, holds policy logic.
> >                   calls delete-file-internal.
> 
> is incorrect, since our ChangeLog generator expects the entries to be
> formatted like so:

That's water under the bridge, as this is Git.  Whoever prepares the
Emacs 30.1 tarball will have to deal with this.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: master 10a7615b5d4: Separate filename-deletion mechanism from policy.
  2023-08-06 14:12     ` Eli Zaretskii
@ 2023-08-07 15:21       ` Andrea Corallo
  0 siblings, 0 replies; 3+ messages in thread
From: Andrea Corallo @ 2023-08-07 15:21 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Po Lu, emacs-devel, esr

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Po Lu <luangruo@yahoo.com>
>> Cc: "Eric S. Raymond" <esr@thyrsus.com>
>> Date: Sun, 06 Aug 2023 21:37:21 +0800
>> 
>> "Eric S. Raymond" <esr@thyrsus.com> writes:
>> 
>> >     This is a pure refactoring step, delete-file's behavior is
>> >     unchanged. But the C core is a little simpler now.
>> > ---
>> >  lisp/files.el | 20 ++++++++++++++++++++
>> >  src/fileio.c  | 40 +++++++++-------------------------------
>> >  2 files changed, 29 insertions(+), 31 deletions(-)
>> >
>> > diff --git a/lisp/files.el b/lisp/files.el
>> > index f8867432000..84a8c308b09 100644
>> > --- a/lisp/files.el
>> > +++ b/lisp/files.el
>> > @@ -6352,6 +6352,26 @@ non-nil and if FN fails due to a missing file or directory."
>> >        (apply fn args)
>> >      (file-missing (or no-such (signal (car err) (cdr err))))))
>> >  
>> > +(defun delete-file (filename &optional trash)
>> > +  "Delete file named FILENAME.  If it is a symlink, remove the symlink.
>> > +If file has multiple names, it continues to exist with the other names.q
>>                                                                           ^
>> Typo alert!
>> 
>> Thanks.  While I'm not enthusiastic about moving functions from C to
>> Lisp, others seem to appreciate the gesture, so I won't mention this
>> subject now.
>
> This kind of changes should have been discussed before it was
> installed.  There are several issues I can see here:
>
>   . delete-file-internal must call expand-file-name on its argument,
>     as all primitives that interface to the filesystem must; I fixed
>     that;
>   . Emacs will now be unable to call delete-file or rename-file during
>     loadup, until files.el is loaded -- not sure if this is a problem,
>     but I guess we will see;
>   . the changeset failed to adjust internal_delete_file, which still
>     called Fdelete_file; I fixed that (I hope, see below)
>
> Andrea, please take a look at the last bullet above: I made
> internal_delete_file call Fdelete_file_internal, which means it no
> longer supports remote files.  If that is a problem, we should call
> Qdelete_file there, but then I wonder whether calling Lisp at that
> place, even though delete-file is preloaded, can cause any trouble?

I think calling Qdelete_file *should* work as we guard against circular
dependency compilations commanded by the native compiler, but it's
impossible to be sure of that without testing the patch.

Andrea



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-07 15:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <169132873104.29568.5167661370136073295@vcs2.savannah.gnu.org>
     [not found] ` <20230806133211.6301AC038BE@vcs2.savannah.gnu.org>
2023-08-06 13:37   ` master 10a7615b5d4: Separate filename-deletion mechanism from policy Po Lu
2023-08-06 14:12     ` Eli Zaretskii
2023-08-07 15:21       ` Andrea Corallo

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.