2

I have used emacs for erlang programming. According to http://emacswiki.org/emacs/CompileCommand, I have configure c-c c for recompile. In the emacs frame, 6 windows are open, top 3 are for erlang source code reading and writing. In the below windows, one is supposed for the compie window. But when different windows is active and recompile, the compile window will switch randomly. How to fix it in one perticular window?

Chen Yu
  • 3,955
  • 1
  • 24
  • 51
  • 2
    This is very much the same problem as in http://stackoverflow.com/questions/1002091/how-to-force-emacs-not-to-display-buffer-in-a-specific-window – Charlie Martin Apr 08 '12 at 13:58
  • 1
    I think it's more the inverse of that question -- we don't want to *avoid* a specific window; we want to avoid *all* windows other than a specific one. – phils Apr 08 '12 at 15:58

1 Answers1

5

If you start reading at C-hf display-buffer RET (or in the manual at M-: (info "(elisp) Choosing Window") RET), you'll find a bunch of ways in which you can modify the behaviour.

It can get a little complex, but something like this might be all you need in your recompile function:

(let ((display-buffer-overriding-action
       '(display-buffer-reuse-window)))
  (compile))

I always use dedicated windows when I want to keep things in the one place, so you might also find that useful to look into:

M-: (info "(elisp) Dedicated Windows") RET

I use the toggle-window-dedicated function from Pin Emacs buffers to windows (for cscope) (see also How do I make this Emacs frame keep its buffer and not get resized?)

Community
  • 1
  • 1
phils
  • 71,335
  • 11
  • 153
  • 198