Subject: Wrong pop-to-buffer behavior after one display-buffer-in-side-window call

From: Dmitry Gutov <[email-masked]>
Date: Thu, 19 Jun 2025 05:19:27 +0300

X-Debbugs-Cc: [email-masked]

Hi Martin and others!

I've started noticing this recently, and it especially gets apparent 
with the new "lexical binding is nil" compilation warning windows which 
use a side window.

A self-contained reproducer took some effort, though.

To use the attached script, load it from the command line like this:

   src/emacs -Q -l d-b-below-bug.el

NOTE: Simply evaluating it from an interactive session won't work 
because it seems to require a particular sequence of buffer/window 
creation operations. It does seem to work to copy it form-by-form to 
evaluate with M-:.

Anyway, the crux of the problem is that after a side window had been 
used, later commands that use pop-to-buffer would reside the window 
unnecessarily, and then not restore the previous size on quit either.

Probably related to the recent changes in window.el, though I haven't 
bisected yet. But this definitely does not reproduce with Emacs 30 or 
earlier releases.