From: "Drew Adams" <drew.adams@oracle.com>
To: "'martin rudalics'" <rudalics@gmx.at>
Cc: 'Emacs Devel' <emacs-devel@gnu.org>
Subject: RE: lru-window, window--try-to-split-window, split-width-threshold
Date: Fri, 22 Aug 2008 16:45:06 -0700 [thread overview]
Message-ID: <000301c904b1$6bf7e360$0200a8c0@us.oracle.com> (raw)
In-Reply-To: <48AEF125.4060506@gmx.at>
> > `split-width-threshold' was apparently introduced
> > recently. Depending on its value, the lru-window
> > can now get split horizontally to display *Completions*
> > during minibuffer input.
> >
> > I have code that changes the display of completions
> > (columns, spacing etc.), depending on the width
> > *Completions* will have when it is displayed. Before it
> > is displayed, I obtain (window-width (get-lru-window)) and
> > use that as the assumed window width.
> >
> > This is no longer adequate, however, because the effective
> > width might be, say, half of that if the lru window gets
> > split horizontally to display *Completions*.
> > And I can't simply use half of that width systematically,
> > because there might be no horizontal split, depending on
> > `split-width-threshold'. I don't know a way to know ahead
> > of time whether a horizontal split will occur (without
> > reproducing all of the code/logic of
> > `window--try-to-split-window' - checking for dedicated
> > windows etc.).
>
> So you can't fill the buffer _after_ the splitting occurred?
> Relying on someone else to always choose the LRU window is
> not very clean in the first place.
Right you are.
I use code similar to that used in Emacs. The formatting is done inside
`with-output-to-temp-buffer', which displays the buffer only at the end.
> > I tried this: (window--try-to-split-window (get-lru-window)),
> > figuring that I might as well split the lru-window myself,
> > if it is going to be split, so that I can get its new width
> > and use that.
> >
> > The problem with this is that once the split occurs the
> > window that was split is apparently no longer the lru window,
> > so *Completions* gets displayed by splitting yet another window.
>
> Are you sure?
No. ;-) In fact, looking again at the `display-buffer' code, I see what the
problem was:
(setq window-to-use
(or (window--try-to-split-window
(get-largest-window frame-to-use t))
(window--try-to-split-window
(get-lru-window frame-to-use t))))
I split the lru window, but then `display-buffer' split the largest window, so
two were split. And that's not all. To determine which window `display-buffer'
would use, I would in fact need to duplicate a good deal of the logic from
`display-buffer'.
So I took your suggestion and displayed *Completions* first. Thx.
next prev parent reply other threads:[~2008-08-22 23:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-22 16:04 lru-window, window--try-to-split-window, split-width-threshold Drew Adams
2008-08-22 17:02 ` martin rudalics
2008-08-22 23:45 ` Drew Adams [this message]
2008-08-27 21:14 ` Stefan Monnier
2008-08-27 21:51 ` Drew Adams
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='000301c904b1$6bf7e360$0200a8c0@us.oracle.com' \
--to=drew.adams@oracle.com \
--cc=emacs-devel@gnu.org \
--cc=rudalics@gmx.at \
/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).