From 254b06993363f20f82b5f2916e890e30a492ba45 Mon Sep 17 00:00:00 2001 From: Lin Sun 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