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


Message #53 received at 55169 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> linkov.net>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 55169 <at> debbugs.gnu.org
Subject: Re: bug#55169: Can't combine window-min-height with window-height
Date: Fri, 6 May 2022 16:10:15 +0200
>> You mean the value of a 'window-height' entry could also be a
>>
>>          • A list whose CAR is a function and whose remaining elements
>>            are the arguments passed to that function.
>>
>> so we'd run
>>
>> 	    (ignore-errors (funcall (car height) window (nth 1 height) ...))
>>
>> in 'window--display-buffer'?  Which means the caller has to know the
>> function and which arguments it needs in which order.  Sounds fragile.
>
> It is intended only for special handling of 'fit-window-to-buffer'.
> If 'fit-window-to-buffer' with MIN-HEIGHT will really fix this problem,
> then details of the entry format could be adapted later.
> And indeed this works exactly as should with
>
> (pop-to-buffer (generate-new-buffer "*edit string*")
>                   '(display-buffer-below-selected
>                     (window-height . fit-window-to-buffer)))
>
> and an experimental patch:
>
> diff --git a/lisp/window.el b/lisp/window.el
> index 9f78784612..a21cf109a4 100644
> --- a/lisp/window.el
> +++ b/lisp/window.el
> @@ -7336,7 +7336,9 @@ window--display-buffer
>   	         (window-resize window delta nil 'safe t)))
>             (setq resize-temp-buffer-window-inhibit 'vertical))
>            ((functionp height)
> -	  (ignore-errors (funcall height window))
> +	  (if (eq height 'fit-window-to-buffer)
> +              (ignore-errors (funcall height window nil 10))
> +            (ignore-errors (funcall height window)))
>             (setq resize-temp-buffer-window-inhibit 'vertical)))
>   	;; Adjust width of window if asked for.
>   	(cond

This boils down to what I sketched above: ALIST must supply a list whose
car is 'fit-window-to-buffer' and 'window--display-buffer' supplies the
window used as first argument in its call to 'fit-window-to-buffer' and
the rest of the list as the remaining arguments.

martin

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.