Subject: Re: bug#55169: Can't combine window-min-height with window-height

From: martin rudalics <[email-masked]>
Date: Sat, 30 Apr 2022 10:03:33 +0200

> I'd expect that to work as you describe (or perhaps with the alist in
 > opposite order), and it doesn't.  Perhaps Martin has some comments;
 > added to the CCs.

Ideally, a 'window-min-height' entry should be applied when an existing
window is used via 'display-buffer-use-some-window'.  Just that in such
case we (i) don't even look at that entry and (ii) we would not apply a
'window-height' entry in the first place because that one is only used
for new windows or windows that always showed one and the same buffer.

Now

 >> 1. first set window-height with fit-window-to-buffer;
 >> 2. then check if the constraint of window-min-height is fulfilled,
 >>     and shrink too high window.

is in general non-trivial because "1." constitutes a fait accompli: We
need a _real_ window to calculate its desired size and whether it is
'window-resizable' to that size.  So we may have to split some window
first to make "1." work.  But what would we do then if "2." were not
satisfied?  Restore the frame to a window configuration saved before
splitting?

Which means that the strategy proposed above would work seamlessly with
'display-buffer-reuse-window' only.  But then would we really reject a
window showing a buffer already only because it's not large enough?

As usual we are caught in between long established conveniences and more
rigorous guide lines for how 'display-buffer' should behave.

martin