Subject: Re: bug#78835: Wrong pop-to-buffer behavior after one display-buffer-in-side-window call

From: martin rudalics <[email-masked]>
Date: Tue, 15 Jul 2025 10:06:14 +0200

>> You typed C-x v = in a configuration with two side-by-side windows,
 >> right?
 >
 > Yes. Ones with seemingly equal width.
 >
 >>  > And then pressing 'q' in it restored that width.
 >>
 >> If the width changed after displaying the buffer, this is the expected
 >> behavior.
 >
 > After displaying and/or after quitting it.

After quitting it.

 >> Here I can trigger it as follows with emacs -Q: Show window.el in a left
 >> window and a *Help* buffer in the right window.  The ‘quit-restore’
 >> parameter of the *Help* window is
 >>
 >> (window window #<window 3 on window.el> #<buffer *Help*>)
 >
 > Not exactly the same value that I see, but I guess that depends on how
 >  the Help buffer was created anyway.

Right.

 >> Now I do C-x v = in the left window which displays the diff buffer in
 >> the right window but does _not_ change its width.  Next I change the
 >> width of the right window by dragging the mode line divider with the
 >> mouse, type 'q' in the right window and am asked
 >>
 >> (window window #<window 3 on window.el> *Help*) ... (*Help* 1 #<marker at 1160 in *Help*> 93) (y or n) y
 >>
 >> where the 93 is the previous width which gets restored if I type 'y'.
 >> What do you get?
 >
 > I get the same (if the windows windows are equal in the
 > beginning). And it's somewhat surprising but also logical at the same
 > time.

'quit-window' is primarily thought to work for short-lived windows where
the configuration before displaying the buffer is still visually present
in the user's mind.  Like restoring a window configuration, but without
deleting newer windows or recreating older ones.

 > OT2H, I also see 'vc-diff' resizing the width (evening the windows) if
 > its target window takes up less than half of the frame.

I suppose that you want to customize 'even-window-sizes' here.

 > Is that a new behavior? I don't think I've noticed it before. Not sure
 > I like it in principle either (my widths are usually either even, or
 > more rarely uneven with a specific purpose). It also only happens if
 > the window spans the whole height, but not inside a vertical split.

Evening widths was added for Emacs 25 - ten years minus one week ago.

martin