unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Davor Rotim <drot@firemail.cc>, 39822@debbugs.gnu.org
Subject: bug#39822: 27.0.90; Cannot set *Completions* buffer height using display-buffer-alist
Date: Sat, 29 Feb 2020 08:53:18 +0100	[thread overview]
Message-ID: <fc45d6fe-1b5b-9f9e-258d-497aa05e2f27@gmx.at> (raw)
In-Reply-To: <87k146q02n.fsf@firemail.cc>

 > 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





  reply	other threads:[~2020-02-29  7:53 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-28 14:05 bug#39822: 27.0.90; Cannot set *Completions* buffer height using display-buffer-alist Davor Rotim
2020-02-29  7:53 ` martin rudalics [this message]
2020-02-29 15:26   ` Davor Rotim
2020-02-29 16:05     ` martin rudalics
2020-02-29 21:10       ` Juri Linkov
2020-03-01  8:52         ` martin rudalics
2020-03-01 23:29           ` Juri Linkov
2020-03-03 14:40             ` martin rudalics
2020-03-03 23:06               ` Juri Linkov
2020-03-04 17:30                 ` martin rudalics
2020-03-04 23:58                   ` Juri Linkov
2020-03-05  9:13                     ` martin rudalics
2020-03-05 23:43                       ` Juri Linkov
2020-03-09  9:02                         ` martin rudalics
2020-03-12 22:54                           ` Juri Linkov
2020-03-13  9:38                             ` martin rudalics
2020-03-14 23:24                               ` Juri Linkov
2020-03-15 17:49                                 ` martin rudalics
2020-03-15 23:47                                   ` Juri Linkov
2020-03-16  9:24                                     ` martin rudalics
2020-03-28 23:36                                       ` Juri Linkov
2020-03-29  9:10                                         ` martin rudalics
2020-03-29 22:57                                           ` Juri Linkov
2020-03-30 22:53                                             ` Juri Linkov
2020-03-31  8:38                                             ` martin rudalics
2020-04-02 21:50                                               ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fc45d6fe-1b5b-9f9e-258d-497aa05e2f27@gmx.at \
    --to=rudalics@gmx.at \
    --cc=39822@debbugs.gnu.org \
    --cc=drot@firemail.cc \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).