GNU bug report logs - #55169
Can't combine window-min-height with window-height

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Thu, 28 Apr 2022 18:04:01 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 55169 <at> debbugs.gnu.org
Subject: bug#55169: Can't combine window-min-height with window-height
Date: Fri, 13 May 2022 19:58:40 +0300
>> Adding an alist is a good idea, but unfortunately it's not backwards-compatible.
>
> That's what I'm trying to bring up ever since we started this thread.
> AFAICT we'd need two new functions at least - an action function say
> 'display-buffer-split-window'

Can the existing 'display-buffer-in-direction' be used to split window?
Or a new action 'display-buffer-split-in-direction' is needed?

> and a 'dislay-buffer-fit-window' function
> - both accepting the ALIST as (additional) argument.

But they can't be used simultaneously?  When 'display-buffer-split-window'
splits the window, then the next 'dislay-buffer-fit-window' is not called?

>>> Think of an application suggesting 'fit-window-to-buffer' with some
>>> 'window-min-height' value and a user who wants to use
>>> 'shrink-window-if-larger-than-buffer' instead but still use the
>>> 'window-min-height' value proposed by the application.  How would we do
>>> that?
>>
>> I have no idea how to make this backwards-compatible.
>
> It can be done with global variables but the resulting code will be
> neither elegant nor comprehensible.  IMO any such information must be
> inevitably passed on through the ALIST argument.

Maybe a new alist key could be added, e.g. 'window-fit',
that is like 'window-height' but also adds the new arg 'alist'?

>> Definitively the functions that create a new window
>> should take into account height constraints.
>> But not sure about functions that select the existing window.
>> Should they resize the existing window?
>
> They do so already.  With emacs -Q do
>
> (pop-to-buffer (get-buffer-create "*edit string*")
>                '(display-buffer-below-selected
>                  (window-height . (lambda (window)
>                                     (fit-window-to-buffer window nil 10)))))
>
> followed by
>
> (pop-to-buffer (get-buffer-create "*edit string*")
>                '(display-buffer-below-selected
>                  (window-height . (lambda (window)
>                                     (fit-window-to-buffer window nil 20)))))

Nice!




This bug report was last modified 3 years and 28 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.