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

From: Eli Zaretskii <[email-masked]>
Date: Sun, 15 Dec 2024 10:04:19 +0200

> From: Lin Sun <[email-masked]>
> 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.

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

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.)

Thanks.