unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Juri Linkov <juri@linkov.net>
Cc: 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: Sun, 15 Mar 2020 18:49:35 +0100	[thread overview]
Message-ID: <7581d32e-f8b9-0d66-b496-b2584ffb65be@gmx.at> (raw)
In-Reply-To: <8736aaedgb.fsf@mail.linkov.net>

 > These calls should remain in 'window--display-buffer' to adjust the
 > window height afterwards.

Yes.

 >> But what if a function like 'dired-format-columns-of-files' wanted to
 >>
 >> (1) know the width of the window used for displaying the buffer,
 >
 > 'dired-format-columns-of-files' is called when the window
 > is already displayed, so it can find the width of the window,
 > and it uses 'completion--insert-strings' for that, see below.

Does it know the window for sure?  Always think of the case where the
buffer is already displayed in some other window.

 >> (2) according to that (presumably fixed) width adjust columns, establish
 >> a maximum width of buffer lines or do something else width related,
 >
 > Same as above.
 >
 >> (3) leave it to 'window--display-buffer' to adjust the window height
 >> afterwards?
 >
 > It already allows 'window--display-buffer' to adjust the window height
 > afterwards in the previous patch.
 >
 >> And be able to do (1)-(3) in the orthogonal direction, that is, base (2)
 >> on a presumably fixed window height?
 >
 > You mean to not allow adjusting the window height afterwards?
 > Then the call of 'display-buffer' should be without alist entries
 > 'window-height' and 'preserve-size'.

We have to be always prepared for the case that a split happens in the
orthogonal direction.

 > The current implementation doesn't supply the window, and
 > 'dired-format-columns-of-files' and 'minibuffer-completion-help'
 > use 'completion--insert-strings':
 >
 > 	   (window (get-buffer-window (current-buffer) 0))

That's precisely what I'm afraid of (and it happens in a dozen other
cases in our code base as well, IIRC).  Better make sure now that we
always act on the window returned by 'display-buffer'.

 > 	   (wwidth (if window (1- (window-width window)) 79))
 >
 > Do you propose to rewrite 'completion--insert-strings' for accept a new
 > argument 'window'?  Or to rely on the fact that the displayed window should
 > be already selected by its caller?  Will this break backward-compatibility
 > for packages that use it?

Maybe it's overkill but I'd give 'completion--insert-strings' an
additional window argument.

martin





  reply	other threads:[~2020-03-15 17:49 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
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 [this message]
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=7581d32e-f8b9-0d66-b496-b2584ffb65be@gmx.at \
    --to=rudalics@gmx.at \
    --cc=39822@debbugs.gnu.org \
    --cc=drot@firemail.cc \
    --cc=juri@linkov.net \
    /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).