bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: martin rudalics
Subject: 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]