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: Sat, 28 Dec 2024 08:04:52 +0000	[thread overview]
Message-ID: <TYCPR01MB100042551D4F4777D84FB2011FB0F2@TYCPR01MB10004.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <864j2ow93z.fsf@gnu.org>


[-- Attachment #1.1: Type: text/plain, Size: 371 bytes --]

> From: Eli Zaretskii <eliz@gnu.org>
> Sent: Friday, December 27, 2024 11:38 PM
> > +  (let ((inhibit-interaction nil))
>                                 ^^^
> This should be t, not nil.

My apologies for posted the testing code (I toggled t/nil to test the behavior on my local).

And I attached a new version of the patch, please help review again. Thank you!

[-- Attachment #1.2: Type: text/html, Size: 1657 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-vc-ediff-util.el-Remove-temp-files-on-kill-emac.patch --]
[-- Type: text/x-patch; name="0001-lisp-vc-ediff-util.el-Remove-temp-files-on-kill-emac.patch", Size: 1269 bytes --]

From 254b06993363f20f82b5f2916e890e30a492ba45 Mon Sep 17 00:00:00 2001
From: Lin Sun <sunlin7@hotmail.com>
Date: Sun, 15 Dec 2024 06:52:17 +0000
Subject: [PATCH] * lisp/vc/ediff-util.el: Remove temp files on kill-emacs

---
 lisp/vc/ediff-util.el | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el
index 6038f3eae30..87d6f7c4aec 100644
--- a/lisp/vc/ediff-util.el
+++ b/lisp/vc/ediff-util.el
@@ -213,6 +213,14 @@ ediff-setup-keymap
   (fset 'ediff-mode-map ediff-mode-map)
   (run-hooks 'ediff-keymap-setup-hook))
 
+(defun ediff--delete-temp-files-on-kill-emacs ()
+  "Delete the temp-files associated with the ediff buffers."
+  (ignore-errors
+    (let ((inhibit-interaction t))
+      (dolist (b (buffer-list))
+        (with-current-buffer b
+          (when (eq major-mode 'ediff-mode)
+            (ediff-delete-temp-files)))))))
 
 ;;; Setup functions
 
@@ -488,6 +496,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))
-- 
2.34.1


  reply	other threads:[~2024-12-28  8:04 UTC|newest]

Thread overview: 12+ 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
2024-12-27  5:38     ` Lin Sun
2024-12-27  8:10       ` Eli Zaretskii
2024-12-27 17:34         ` Lin Sun
2024-12-28  7:38           ` Eli Zaretskii
2024-12-28  8:04             ` Lin Sun [this message]
2024-12-28 12:41               ` Eli Zaretskii
2024-12-28 17:40                 ` Lin Sun
2024-12-29  1:49               ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-29  2:25                 ` Lin Sun

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=TYCPR01MB100042551D4F4777D84FB2011FB0F2@TYCPR01MB10004.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).