GNU bug report logs - #74881
31.0.50; [PATCH] * lisp/vc/ediff-util.el: Remove temp files on kill-emacs

Previous Next

Package: emacs;

Reported by: Lin Sun <sunlin7 <at> hotmail.com>

Date: Sun, 15 Dec 2024 06:00:02 UTC

Severity: normal

Tags: patch

Found in version 31.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 74881 <at> debbugs.gnu.org (full text, mbox):

From: Lin Sun <sunlin7 <at> hotmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: "74881 <at> debbugs.gnu.org" <74881 <at> debbugs.gnu.org>
Subject: Re: bug#74881: 31.0.50; [PATCH] * lisp/vc/ediff-util.el: Remove temp
 files on kill-emacs
Date: Sun, 15 Dec 2024 17:25:29 +0000
> From: Eli Zaretskii <eliz <at> gnu.org>
> Sent: Sunday, December 15, 2024 12:04 AM
> > From: Lin Sun <sunlin7 <at> hotmail.com>
> > Date: Sun, 15 Dec 2024 05:59:40 +0000
> >
> > @@ -488,6 +494,7 @@ ediff-setup
> >        (if (ediff-buffer-live-p ediff-meta-buffer)
> >          (ediff-update-meta-buffer
> >           ediff-meta-buffer nil ediff-meta-session-number))
> > +      (add-hook 'kill-emacs-hook #'ediff--delete-temp-files-on-kill-emacs)
> >        (run-hooks 'ediff-startup-hook)
> >        ) ; eval in control-buffer
> >      control-buffer))
>
> This should be carefully programmed to avoid preventing Emacs from
> exiting due to some problem.  If ediff-delete-temp-files or one of the
> functions it calls can signal an error, it should be wrapped by
> condition-case, and if it or one of its callees can try interacting
> with the user, we should use kill-emacs-query-functions instead.

The function ediff-delete-temp-files was called at the tail of Ediff  quit routine, 
will be also safe on kill-emacs routine, and can confirm it dose not interactive 
with the user. Actually it deletes the temp files created by Ediff-mode, should 
has full privilege to do its job.

> Alternatively, we could end the Ediff session when Emacs is killed.

It maybe heavy to end the Ediff session if the user choose 
`ediff-setup-windows-plain` as the `ediff-window-setup-function` for a graphic 
frame, then ending a Ediff session will trigger emacs graphic frames layout change 
(Ediff will restore frames layout to the one before its startup).  So here we just try 
clean up the temp files to avoid the heavy works.

> Bottom line: this is a minor cleanup feature, so we should be very
> careful not to cause any regressions and problems just because we want
> to exit more cleanly.  (On most systems, files in /tmp are routinely
> deleted by system's cleanup processes anyway.)

Agree and calling the ediff-delete-temp-files should only for the scenario 
that user kill emacs during an Ediff-session, otherwise it will do nothing. 

Thank you.



This bug report was last modified 134 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.