* Controlling which windows can be selected by display-buffer-pop-up-window
@ 2013-12-21 18:18 Jarosław Rzeszótko
2013-12-22 15:37 ` martin rudalics
0 siblings, 1 reply; 3+ messages in thread
From: Jarosław Rzeszótko @ 2013-12-21 18:18 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 2537 bytes --]
Hi,
Is there any chance a more flexible mechanism for controlling which window
is chosen to be split when a new buffer is about to displayed could make it
into Emacs? I have been trying to implement a way to keep a toggleable
terminal or compilation window at the bottom of an Emacs frame, that is
only a few lines high and is never split or deleted unless the users
requests it - I think this is a perfectly reasonable feature many people
would like, and one present in many environments those days. Currently, to
the extent I managed to learn, implementing a window that consistently
keeps a fixed position and size and is never split, is possible only in two
ways, one is a really dirty hack, and the second one requires
reimplementing a lot of the mechanisms in window.el.
What splits dedicated windows most frequently is a call to
display-buffer-pop-up-window from display-buffer, and
display-buffer-pop-up-window always uses either get-largest-window or
get-lru-window as the window to split for displaying the new buffer, and it
ignores whether the window is dedicated or not by passing t as the second
argument to those functions. So, the only way to do this which would not
require multiple days of effort is to basically break the
get-largest-window and get-lru-window functions to always ignore dedicated
windows, and I have only learnt of this after spending multiple hours in
window.el and examining the ECB package, which does something like this:
(defadvice get-largest-window (before xyz)
(and (ad-get-arg 1) (ad-set-arg 1 nil)))
(ad-activate 'get-largest-window)
(defadvice get-lru-window (before xyz)
(and (ad-get-arg 1) (ad-set-arg 1 nil)))
(ad-activate 'get-lru-window)
The only other existing path of implementing this I see is to add a new
function to display-buffer-overriding-action, but then this function has to
somehow reimplement all the default behaviour of Emacs just to exclude one
window from being selected, because the behaviour of existing functions
like display-buffer--maybe-pop-up-frame-or-window can not be changed by
passing another argument or anything like this.
I think another window parameter in addition to dedicated, like
"persistent", and excluding windows with the parameter from all the default
Emacs window-to-be-split selection functions would make the problem go
away, and I don't see any disadvantages of this. I am of course willing to
contribute a patch, if this sounds like a reasonable idea.
Cheers,
Jarosław Rzeszótko
[-- Attachment #2: Type: text/html, Size: 2658 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Controlling which windows can be selected by display-buffer-pop-up-window
2013-12-21 18:18 Controlling which windows can be selected by display-buffer-pop-up-window Jarosław Rzeszótko
@ 2013-12-22 15:37 ` martin rudalics
2013-12-22 15:56 ` Jarosław Rzeszótko
0 siblings, 1 reply; 3+ messages in thread
From: martin rudalics @ 2013-12-22 15:37 UTC (permalink / raw)
To: Jarosław Rzeszótko; +Cc: emacs-devel
> Is there any chance a more flexible mechanism for controlling which window
> is chosen to be split when a new buffer is about to displayed could make it
> into Emacs? I have been trying to implement a way to keep a toggleable
> terminal or compilation window at the bottom of an Emacs frame, that is
> only a few lines high and is never split or deleted unless the users
> requests it - I think this is a perfectly reasonable feature many people
> would like, and one present in many environments those days. Currently, to
> the extent I managed to learn, implementing a window that consistently
> keeps a fixed position and size and is never split, is possible only in two
> ways, one is a really dirty hack, and the second one requires
> reimplementing a lot of the mechanisms in window.el.
To avoid that a window is split, fix its buffer's height (see the
variable `window-size-fixed').
To show a window continuously at the bottom of a frame, use the function
`display-buffer-in-side-window' with a 'bottom argument.
No dirty hacks needed ;-)
martin
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Controlling which windows can be selected by display-buffer-pop-up-window
2013-12-22 15:37 ` martin rudalics
@ 2013-12-22 15:56 ` Jarosław Rzeszótko
0 siblings, 0 replies; 3+ messages in thread
From: Jarosław Rzeszótko @ 2013-12-22 15:56 UTC (permalink / raw)
To: martin rudalics; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1270 bytes --]
Hi,
Thank you, that seems to work perfectly well!
Cheers,
Jarosław Rzeszótko
2013/12/22 martin rudalics <rudalics@gmx.at>
> > Is there any chance a more flexible mechanism for controlling which
> window
> > is chosen to be split when a new buffer is about to displayed could make
> it
> > into Emacs? I have been trying to implement a way to keep a toggleable
> > terminal or compilation window at the bottom of an Emacs frame, that is
> > only a few lines high and is never split or deleted unless the users
> > requests it - I think this is a perfectly reasonable feature many people
> > would like, and one present in many environments those days. Currently,
> to
> > the extent I managed to learn, implementing a window that consistently
> > keeps a fixed position and size and is never split, is possible only in
> two
> > ways, one is a really dirty hack, and the second one requires
> > reimplementing a lot of the mechanisms in window.el.
>
> To avoid that a window is split, fix its buffer's height (see the
> variable `window-size-fixed').
>
> To show a window continuously at the bottom of a frame, use the function
> `display-buffer-in-side-window' with a 'bottom argument.
>
> No dirty hacks needed ;-)
>
> martin
>
[-- Attachment #2: Type: text/html, Size: 1740 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-12-22 15:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-21 18:18 Controlling which windows can be selected by display-buffer-pop-up-window Jarosław Rzeszótko
2013-12-22 15:37 ` martin rudalics
2013-12-22 15:56 ` Jarosław Rzeszótko
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.