1

I'm a developer who uses emacs. In emacs I use multiple frames (what most people would call X windows), and the compile function for my builds. I like to have one frame for my compilation buffer, and the others for source. That allows me to navigate to build errors easily and get a nice big view of the source I'm investigating along side a nice big view of my build output. This works fine when I use the 'next-error' function from a source frame.

But when I move my pointer into the compilation frame, and click on an error, it vertically splits that frame to show the relevant source. I want it to show the relevant source in one of my other frames.

Is there a way to "lock" a frame so that it won't be split into windows, and so other frames will be used instead? I'm OK if it splits one of my other frames to display the new source files - just not the compilation frame (because that means I have to unsplit that frame and then switch the buffer of a different frame to display the buffer in question - that's cumbersome).

Alternatively it would be fine if I could use a different mouse button on an error in the compilation buffer to say "visit this file and line in a different frame".

BobDoolittle
  • 1,326
  • 1
  • 12
  • 21

1 Answers1

1

I believe you can achieve your goals by making the window in your "compile frame" dedicated:

Functions for displaying a buffer can be told to not use specific windows by marking these windows as dedicated to their buffers.

Interactively, M-x set-window-dedicated-p should make your window dedicated.

From elisp, something like

(set-window-dedicated-p (selected-window) 1)

should do the same. Replacing 1 with t will make the window strongly dedicated:

As a special case, if flag is t, window becomes strongly dedicated to its buffer. set-window-buffer signals an error when the window it acts upon is strongly dedicated to its buffer and does not already display the buffer it is asked to display. Other functions do not treat t differently from any non-nil value.

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
  • 1
    I can't use M-x but I can use elisp in eval-expression. Unfortunately this doesn't seem to have the desired effect. I still get my window split, even if I use a flag of 't'. – BobDoolittle May 07 '14 at 14:14
  • I think the issue here is that dedicated "windows" are dedicating the *emacs* definition of window, rather than the X definition of window (which emacs calls a frame). I would like something more like a dedicated frame I think. – BobDoolittle May 07 '14 at 14:18
  • @user3149905, perhaps [this question](http://stackoverflow.com/questions/5151620/how-do-i-make-this-emacs-frame-keep-its-buffer-and-not-get-resized) will be helpful? – ChrisGPT was on strike May 07 '14 at 14:32
  • Sorry Chris - not seeing it. That's all about dedicated windows again. As far as I can tell, dedicated window functionality prevents a buffer from being automatically switched out of a frame, but it doesn't prevent splitting of the frame to display another buffer. At least not in the case of compile.el - maybe it's doing something funky that is overriding the intended functionality when you click on an error in the *compilation* buffer. – BobDoolittle May 07 '14 at 18:15
  • @user3149905, I'm sorry to hear that I wasn't able to help. You may have to customize whatever major mode the compilation buffer uses. Good luck! – ChrisGPT was on strike May 07 '14 at 18:38