Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Too many split screens opening in Emacs!

Ever since I installed emacs on a new machine I have seen an ugly behaviour. Unfortunately, my old .emacs files are rather fragmented and I can't determine whether I used to have elisp that took care of this.

The problem is this: it used to be that when I performed a command that would open a new buffer such as grep'ing, or clicking a file name within search results, one of two things would happen:

  1. If only one buffer is showing, the screen will split once
  2. If more than one buffer is showing, the buffer window after the current buffer window would open the desired file

I want this behaviour back. What I am getting now is the following:

Emacs will keep splitting the window until four buffer windows are open. If I continually click multiple grep results, the buffer window where they open cycles through the three other (non-grep-results) buffer windows. I'd like it if they just kept opening in the same location: the "next" buffer window beside/below the results--same buffer window every time.

Any thoughts on how to achieve this behaviour?

like image 929
user168811 Avatar asked Sep 04 '09 22:09

user168811


People also ask

How do I get rid of split screen in Emacs?

Use the C-x b command or the Buffers menu. Or if you haven't opened the file, yet, use the C-x C-f command to open the new file in a new buffer. To unsplit the window, use the command C-x 1 or right-click on either title bar.

How do I open multiple Emacs windows?

Splitting WindowsThe command C-x 2 ( split-window-vertically ) breaks the selected window into two windows, one above the other. Both windows start out displaying the same buffer, with the same value of point.

How do I open multiple Emacs?

Much better to use the multiple buffer feature of emacs. If you are editing the first file and want to start editing the second file, simply use the hot key C-x C-f or the menu selection File->Open File to start the second file. The second file is loaded into its own buffer.


1 Answers

Consider setting split-height-threshold to a larger value than the frame height; that will prevent unwanted vertical split.

(setq split-height-threshold 999)

If you prefer vertical split over horizontal split, customize split-width-threshold instead.

For more fine-grained control of how a new buffer is displayed, customize display-buffer-function; that will allow you to completely replace the default display-buffer function which dictates the buffer display policy.

like image 128
huaiyuan Avatar answered Oct 18 '22 07:10

huaiyuan