Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs: define target window for command output

Tags:

emacs

elisp

I'm tired of emacs clobbering my windows with its output, and unpredictably at that. I'd like to have several windows in emacs frame and have each window dedicated for a certain purpose only. For example,

ECB panels |  Editor 1 | Editor 2 |  Bookmarks+
------------------------------------------------
"Messages" (output buffer)

So, when I run M-x compile, I want the output to always go into Messages. Similarily, when I run M-x magit-status, I want results in Messages, as well. Clicking on a bookmark or pressing C-x r b should open the file and position the cursor in Editor 1.

I've tried some lisp snippets to "lock" the windows to prevent the changes but the emacs goes nuts when all windows are "locked", cause it can't find an available window to put new output into. This nasty buffer-swap feature that emacs has must be going back to the 80x25 character terminal days.

I've never seen ECB windows get clobbered, so it must be doable somehow.

like image 869
Kiska Avatar asked Oct 18 '13 20:10

Kiska


1 Answers

You are explicitly asking for dedicated windows. Well, Emacs has exactly that feature: dedicated windows. C-h r g dedicated windows tells you pretty much everything you need to know.

But see also special-display-buffer-names and special-display-regexps --- or if you are a masochist, fiddle with display-buffer-alist to do the same thing.

With display-buffer-alist you can in principle do anything you might imagine, including tie your underwear in knots and set it on fire.

(Me, I just set special-display-regexps to ("[ ]?[*][^*]+[*]").)

like image 130
Drew Avatar answered Nov 15 '22 03:11

Drew