M-x stop-this-nonsense
June 4, 2008 6:00 AM   Subscribe

How do I stop emacs from messing with my windows?

Let's say I have two windows open in emacs, working on two different source files. When calling a command with output from within the first window, like a make or latex pass, output from the command goes to the other window, hiding my existing buffer. To make matters worse, killing or switching the output buffer will not always give me my original file back, depending on the number and visiting times of other open files. This gets annoying pretty fast, especially when working on a large project with several files open at a time.

Is there a way to stop emacs from messing up existing windows? I'd like command output to go to a new window, or stay buried until I look it up.

Please note that I won't consider abandoning the One True Editor over this minor point.
posted by ghost of a past number to Computers & Internet (4 answers total)
 
One thing you can do is make the names of these output windows special buffer frames. Then they will always pop up in a new frame. Personally, I find that annoying too, but it won't mess up your window configuration.

My personal approach is to use winner-undo instead. Add (winner-mode) to your ~/.emacs. Then you can use C-c <left> to return to the previous window configuration.
posted by grouse at 6:15 AM on June 4, 2008


You could run the commands from within shell mode; then the output would at least stay where you expect it.
posted by qxntpqbbbqxl at 6:30 AM on June 4, 2008


Best answer: Your window configurations can be saved to and restored from registers, with the commands window-configuration-to-register (C-x r w <reg>) and jump-to-register (C-x r j <reg>), respectively.

If you want to protect specific windows, you can use a function like this:
(defun dedicated-window (&optional arg)
  "Make the current window dedicated to its current buffer, or make
   it un-dedicated with a prefix argument"
  (interactive "P")
  (set-window-dedicated-p (selected-window) (not arg)))

posted by harmfulray at 1:07 PM on June 4, 2008 [1 favorite]


Response by poster: It looks like registers are the way to go here. Funnily enough, winner doesn't do what I want - it just kills the second window. I would guess it uses register functionality, but that doesn't seem to be the case.

The dedicated window is neat, but not practical for this: It must be unlocked before any buffer switch, even intentional. It will come in handy though, to lock down my main file.
posted by ghost of a past number at 9:42 AM on June 5, 2008


« Older Kurdish and Mongolian and Luganda, oh my!   |   You won't steal my heart by stealing my focus Newer »
This thread is closed to new comments.