GNU bug report logs - #77323
[PATCH] Allow temp buffer cleanup in ediff-current-file

Previous Next

Package: emacs;

Reported by: "Paul D. Nelson" <ultrono <at> gmail.com>

Date: Thu, 27 Mar 2025 21:55:02 UTC

Severity: normal

Tags: patch

Done: Sean Whitton <spwhitton <at> spwhitton.name>

Bug is archived. No further changes may be made.

Full log


Message #23 received at 77323 <at> debbugs.gnu.org (full text, mbox):

From: "Paul D. Nelson" <ultrono <at> gmail.com>
To: Sean Whitton <spwhitton <at> spwhitton.name>
Cc: michael_heerdegen <at> web.de, 77323 <at> debbugs.gnu.org
Subject: Re: bug#77323: [PATCH] Allow temp buffer cleanup in ediff-current-file
Date: Sat, 29 Mar 2025 13:46:22 +0100
Hi Sean,

> There is also already ediff-keep-tmp-versions.
>
> Even though some are about files and some are about buffers, I'm
> concerned about these variables proliferating.  It's already quite
> confusing.  Do you think there is any possibility of you reusing one of
> the existing ones?

Let's see.

I think it would be confusing to reuse ediff-keep-tmp-versions (which
concerns temporary VC files) or ediff-keep-variants (which is anyways
hard-coded to "t" via ediff-buffers, hence in ediff-current-file).

I understand the concern about variable proliferation.  Some
alternatives:

1) Make "clean-up" the default behavior for ediff-current-file.

2) Add an optional startup-hooks argument to ediff-current-file, passed
along to ediff-buffers.  This would improve consistency with other Ediff
commands and allow clean-up of temporary buffers via a wrapper command:

(defun my/ediff-current-file-with-cleanup ()
  (interactive)
  (ediff-current-file
   (list
    (lambda ()
      (let ((buffer-to-kill ediff-buffer-A))
        (add-hook 'ediff-quit-hook
                  (lambda () (when (buffer-live-p buffer-to-kill)
                               (kill-buffer buffer-to-kill)))
                  nil t))))))

3) Take advantage of the "FILE=" prefix, which I don't think is used
elsewhere in Emacs:

(add-hook 'ediff-cleanup-hook
          (lambda ()
            (and (buffer-live-p ediff-buffer-A)
                 (string-prefix-p "FILE=" (buffer-name ediff-buffer-A))
                 (kill-buffer ediff-buffer-A))))


Having now stumbled upon solution 3), I think it's the simplest one for
my purposes, if a bit hacky.  It makes my patch unnecessary, so we can
close this report.

Alternatively, if others feel that the undeleted temporary buffer
produced by ediff-current-file represents a bug/issue (e.g., as an
undesired "resource leak") rather than an alternative among preferences,
then I'd be happy to follow-up with either my original patch or one of
the other proposed alternatives.

Thanks for your feedback and best,

Paul




This bug report was last modified 45 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.