GNU bug report logs -
#78897
Ediff 2.81.6; Window restoration with ediff-before-setup-hook doesn't work for ediff-regions-linewise
Previous Next
Reported by: Aaron Zeng <azeng <at> janestreet.com>
Date: Wed, 25 Jun 2025 20:42:02 UTC
Severity: normal
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #10 received at 78897-done <at> debbugs.gnu.org (full text, mbox):
> Cc: app-emacs-dev <at> janestreet.com
> Date: Wed, 25 Jun 2025 16:40:51 -0400
> From: Aaron Zeng via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>
> ediff-before-setup-hook's docstring suggests using it to save and
> restore the window configuration prior to invoking an Ediff command.
> Users at my site have an equivalent to the following hooks:
>
> (defvar my-saved-window-configuration nil)
> (add-hook 'ediff-before-setup-hook
> (lambda ()
> (setq my-saved-window-configuration (current-window-configuration))))
> (add-hook 'ediff-quit-hook
> (lambda ()
> (set-window-configuration my-saved-window-configuration)
> (setq my-saved-window-configuration nil)))
>
> This works fine for most Ediff commands but does not work correctly
> with ediff-regions-linewise and ediff-regions-wordwise. You can
> reproduce the behavior from emacs -Q:
>
> 1. emacs -Q
> 2. Evaluate the above snippet
> 3. M-x ediff-regions-linewise (select an arbitrary pair of buffers and
> regions like selecting *scratch* twice)
> 4. Press q
>
> After quitting, the original window configuration is not restored. In
> particular, the window is split vertically with a short window below
> the selected taller one.
>
> I believe this is because those commands use
> ediff-clone-buffer-for-region-comparison to prompt for regions as diff
> input, and that involves adjusting the window configuration a few
> times. The following patch seems to fix the behavior (edited to
> remove the indentation diff for brevity):
Thanks, I've now installed this on the master branch, and I'm
therefore closing this bug.
This bug report was last modified 13 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.