emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Any way to prevent window splits for a window or a major-mode


From: martin rudalics
Subject: Re: Any way to prevent window splits for a window or a major-mode
Date: Sat, 02 Dec 2017 11:17:05 +0100

> For a window, I would like to be able to mark it so it is never split.

The most simple approach is the one Drew mentioned, something like

(set-window-parameter nil 'split-window #'ignore)

for the selected window.  But this might be too strong with functions
(like `display-buffer') that expect a window to be splittable if it's
just large enough.  So fixing the window size by setting its buffer's
`window-size-fixed' variable or the window's 'window-preserved-size'
parameter as Eric suggested could be more appropriate.  But maybe you
should tell us more about the case where you need such a property -
`split-window' is just the Emacs paradigm for creating a new window
adjacent to an existing one.

> For a major mode, I would like to say for any windows displaying buffers in
> this major mode, don't split them.
>
> Is there a simple way to program that?

You will have to put a function on `window-configuration-change-hook'
which runs through every window and, if it displays a buffer in that
major mode, sets the 'split-window' parameter of that window to 'ignore'
or preserves that window's size.  And obviously the major mode hook
would have to add/remove that parameter for every window showing a
buffer where that mode is turned on/off.

martin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]