3

I have some frames in emacs window, and I want in one of them having open agenda (org mode) but often emacs replaces me content of this frame (for example if I use list packages, rgrep etc).

How to make this frame (and maybe one-two more) inviolable? Something like left panel of neotree.

3

(You have your terms backward: the window-manager "window" is called a frame in Emacs. It can be divided into multiple panes, which Emacs calls windows.)

Make the window be dedicated. Here is one way to do that:

C-h f set-window-dedicated-p:

set-window-dedicated-p is a built-in function in `C source code'.

(set-window-dedicated-p WINDOW FLAG)

Mark WINDOW as dedicated according to FLAG.
WINDOW must be a live window and defaults to the selected one.  FLAG
non-nil means mark WINDOW as dedicated to its buffer.  FLAG nil means
mark WINDOW as non-dedicated.  Return FLAG.

When a window is dedicated to its buffer, `display-buffer' will refrain
from displaying another buffer in it.  `get-lru-window' and
`get-largest-window' treat dedicated windows specially.
`delete-windows-on', `replace-buffer-in-windows', `quit-window',
`quit-restore-window' and `kill-buffer' can delete a dedicated window
and the containing frame.

As a special case, if FLAG is t, mark WINDOW as "strongly" dedicated to
its buffer.  Functions like `set-window-buffer' may change the buffer
displayed by a window, unless that window is strongly dedicated to its
buffer.  If and when `set-window-buffer' displays another buffer in a
window, it also makes sure that the window is no more dedicated.

(What that verbose doc calls "strongly dedicated" is what used to be called "dedicated". See predicate window-dedicated-p.)

Another, simple way, is to tell Emacs that certain buffer names, or buffer names matching a given regexp, are "special-display". That means that their windows are to be dedicated.

You can do this by customizing either or both user options special-display-buffer-names and special-display-regexps. These options are very easy to use.

(Emacs Dev considers these simple and useful user options to be "obsolete", but they are still supported, fortunately. If you want to use what they recommend now, instead of special-display-*, then you'll need to delve into the complex labyrinth of user option display-buffer-alist. You can accomplish the same thing with this option as you can accomplish with the special-display-* (and a lot more). It's just more complicated to do the same thing.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.