3

emacs 23.2

I have just installed emacs on a 10.1" screen netbook.

However, when I compile my source code the compilation window always opens in a horizontal buffer below my source code buffer.

At work I use a 15" screen and the compilation opens up in a vertical window, which is what I like.

However, on my 10.1", is there any way to force it to open in a vertical window. Its just easier to scroll down and find errors when you have the source code buffer vertical to the compilation buffer.

Many thanks for any advice,

ant2009
  • 27,094
  • 154
  • 411
  • 609

3 Answers3

11

Related question here.

(defadvice compile (around split-horizontally activate)
  (let ((split-width-threshold 0)
        (split-height-threshold nil))
    ad-do-it))

If you always want to split horizontally when a new buffer is displayed, you can just set the two variables above and dispense with the advice.

Community
  • 1
  • 1
Sean
  • 29,130
  • 4
  • 80
  • 105
5

Try these settings:

(setq split-height-threshold nil)
(setq split-width-threshold 0)

With respect to needing to scroll down the source code, you should check out C-x ` or M-x next-error and let Emacs do the scrolling for you.

Trey Jackson
  • 73,529
  • 11
  • 197
  • 229
  • Thanks, I do use the next-error. One advantage I find is that having the buffers display vertically is that the errors and lines of code are in parallel with each other. – ant2009 Nov 12 '10 at 03:12
5

Take a look at the section "Choosing a window to display" in the Emacs manual. In particular,

Option split-width-threshold

This variable specifies whether split-window-sensibly may split windows horizontally. If it is an integer, split-window-sensibly tries to horizontally split a window only if it has at least this many columns. If it is nil, split-window-sensibly will not split the window horizontally. (It still might split the window vertically, though, see above.)

Community
  • 1
  • 1
Gareth Rees
  • 64,967
  • 9
  • 133
  • 163