unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lin Sun <sunlin7@hotmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: "74881@debbugs.gnu.org" <74881@debbugs.gnu.org>
Subject: 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	[thread overview]
Message-ID: <TY3PR01MB100135294E087D8E1FF85804EFB3A2@TY3PR01MB10013.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <86h675s77g.fsf@gnu.org>

> From: Eli Zaretskii <eliz@gnu.org>
> Sent: Sunday, December 15, 2024 12:04 AM
> > From: Lin Sun <sunlin7@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.




      reply	other threads:[~2024-12-15 17:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-15  5:59 bug#74881: 31.0.50; [PATCH] * lisp/vc/ediff-util.el: Remove temp files on kill-emacs Lin Sun
2024-12-15  8:04 ` Eli Zaretskii
2024-12-15 17:25   ` Lin Sun [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=TY3PR01MB100135294E087D8E1FF85804EFB3A2@TY3PR01MB10013.jpnprd01.prod.outlook.com \
    --to=sunlin7@hotmail.com \
    --cc=74881@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).