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

From: Dmitry Gutov <[email-masked]>
Date: Thu, 17 Jul 2025 05:14:52 +0300

On 15/07/2025 11:06, martin rudalics wrote:
>  >> 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.

After both, in my scenario (first to even the widths, and later to 
restore the previous widths).

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

Thanks, I can confirm that for Emacs 30, at least.

And indeed my last example (one I could reproduce) seems like reasonable 
behavior in the light of this explanation.

I think the instances where this had been a bigger problem, were when a 
much older width was restored (older in terms of time). If I see those 
again, I'll report back - though IME those situations are usually more 
transient.