GNU bug report logs -
#39822
27.0.90; Cannot set *Completions* buffer height using display-buffer-alist
Previous Next
Reported by: Davor Rotim <drot <at> firemail.cc>
Date: Fri, 28 Feb 2020 14:06:02 UTC
Severity: normal
Tags: fixed
Found in version 27.0.90
Fixed in version 28.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 39822 <at> debbugs.gnu.org (full text, mbox):
> Testing with 'emacs -Q' and the following snippet:
>
> (add-to-list 'display-buffer-alist
> '("\\*Completions\\*"
> (display-buffer-in-side-window)
> (window-height . 0.05)
> (side . bottom)
> (slot . 0)
> (window-parameters . ((no-other-window . t)))))
>
> Seems like the 'window-height' parameter is being ignored and I'm unable
> to set the height for the *Completions* window this way.
You _are_ able to do that since
(display-buffer (get-buffer-create "*Completions*"))
displays the buffer as intended within the bounds of the value you
supplied, the size of the frame, the number of windows it shows ...
> Switching window direction to 'left' or 'right' and setting
> 'window-width' instead of height seems to be working with this altered
> snippet:
>
> (add-to-list 'display-buffer-alist
> '("\\*Completions\\*"
> (display-buffer-in-side-window)
> (window-width . 0.05)
> (side . right)
> (slot . 0)
> (window-parameters . ((no-other-window . t)))))
>
> The 'window-height' parameter gets ignored only when specifying the
> 'top' or 'bottom' side.
What happens is that the function responsible for displaying completions
('minibuffer-completion-help') uses the 'with-displayed-buffer-window'
macro and supplies it with a
'(window-height . fit-window-to-buffer)
argument. 'with-displayed-buffer-window', in these two parts
(vheight-function
(let ((window-height (assq 'window-height (cdr ,vaction))))
(when (functionp (cdr window-height))
(cdr window-height))))
and
(when vheight-function
(ignore-errors
(set-window-parameter ,window 'preserve-size nil)
(funcall vheight-function ,window)))
uses the above supplied 'fit-window-to-buffer' to override the 0.05
window-height value supplied by your customization.
When you display *Completions* in a side window below or above an
already existing side window, you may observe a similar effect for a
side window on the left or right of your frame. And if
'fit-window-to-buffer-horizontally' is non-nil, you may see the effect
even when there is only one side window on the left or right even when
window-width is 0.05.
Strictly spoken, the behavior you describe is a bug because
'minibuffer-completion-help' violates the contract obligations of
'display-buffer'. But displaying completions had its own rules ever
since so I'm not sure what to suggest.
martin
This bug report was last modified 5 years and 53 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.