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

From: Michael Heerdegen <[email-masked]>
Date: Mon, 30 Dec 2024 02:37:33 +0100

Lin Sun <[email-masked]> writes:

> I didn't found a local version of `kill-emacs-hook` example in emacs
> git repo.

I would expect it to work.  I found one in Gnu Elpa, in "subed.el".

> Current version also work for the killing from command line, for
> example executing a "pkill emacs" during ediff session.

I think this feature would not go.

> diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el
> index 33666535843..d448973b345 100644
> --- a/lisp/vc/ediff-util.el
> +++ b/lisp/vc/ediff-util.el
> @@ -219,12 +219,11 @@ ediff--delete-temp-files-on-kill-emacs
>    ;; where this hook could prevent kill-emacs from shutting down Emacs,
>    ;; because user interaction is not possible (e.g., in a daemon), or
>    ;; if deleting these files signals an error.
> -  (ignore-errors
> -    (let ((inhibit-interaction t))
> -      (dolist (b (buffer-list))
> +  (let ((inhibit-interaction t))
> +    (dolist (b ediff-session-registry)
> +      (ignore-errors
>          (with-current-buffer b
> -          (when (eq major-mode 'ediff-mode)
> -            (ediff-delete-temp-files)))))))
> +          (ediff-delete-temp-files))))))
>  
>  ;;; Setup functions

Yes, this is what I had in mind when the local hook can't be used.

Thank you,

Michael.