21 votes

How to change Emacs windows from vertical split to horizontal split?

The transpose-frame package is available on MELPA as well. Use M-x transpose-frame, or bind it to something to accomplish this.
salotz's user avatar
  • 1,400
20 votes
Accepted

Quick way to close all but one window, and then revert to previous window setup?

The different sections of text you see in your Emacs are windows. You can, for example, create a new window with C-x 2. Yes, this terminology is confusing. It predates most GUI systems, so it's ...
zck's user avatar
  • 9,092
18 votes

Open file in new window after searching it with helm

I'm using Spacemacs (on Windows 10 if that matters) with the default keybindings. This may differ from your configuration, but I found the following ways to open files via Helm-Find-Files: Open Helm-...
Jason Down's user avatar
16 votes

Is there a way to change color of active window's fringe?

Since you want "To better distinguish between focused window", you can use other ways to do that instead of just changing the active window's fringe color. I combine three ways to better distinguish ...
CodyChan's user avatar
  • 2,649
15 votes
Accepted

Can I split emacs the window 4 ways (vertically and horizontally) in a 4 grid layout with different files in each?

To split the window in half with a vertical divider, use the command split-window-right. To split it in half with a horizontal divider, use the command split-window-below. For example, assume we ...
JCC's user avatar
  • 1,029
14 votes

Neotree window not resizable

Found a solution. It works if I put this into my config: (setq neo-window-fixed-size nil) The only downside is that neotree does not remember the window width. When you switch buffers it will ...
Rotareti's user avatar
  • 456
11 votes

How can I tell Emacs to always open help buffers in the current window?

If you don't like how help-window-select works you can simply use this code: (add-to-list 'display-buffer-alist '("*Help*" display-buffer-same-window)) You can change "*Help*" with a ...
Jules's user avatar
  • 1,225
11 votes
Accepted

Open new window and switch to it

The following code written by Dawid Eckert and published in his github emacs.config moves the cursor to the newly created buffer: (defun split-and-follow-horizontally () (interactive) (split-...
manandearth's user avatar
  • 2,118
10 votes
Accepted

`switch-to-buffer` vs. `pop-to-buffer-same-window`

The difference is that pop-to-buffer-same-window doesn't insist as much about using the same window. Historically, switch-to-buffer has been used for 2 purposes: change which buffer is shown in the ...
Stefan's user avatar
  • 26.4k
10 votes

Open new window and switch to it

C-x4b runs switch-to-buffer-other-window which switches to the specified buffer (but creates it only there's only one buffer displayed). For more sophisticated behaviour, you'd have to implement the ...
choroba's user avatar
  • 2,045
9 votes

Quick way to close all but one window, and then revert to previous window setup?

Using winner-mode is handy, but if you really just want to flip back and forth between one window and a multi-window configuration, here's something I've used before: (defvar window-split-saved-...
glucas's user avatar
  • 20.6k
9 votes
Accepted

org-babel result to a separate buffer

I've looked through documentation but it seems like there's no such option. Surprising that org does not offer :output buffer option. Maybe this is in the works for future org versions. ... place ...
Emacs User's user avatar
  • 5,643
9 votes

Can I split emacs the window 4 ways (vertically and horizontally) in a 4 grid layout with different files in each?

Use the split-window-xxx commands, as described in another answer. If you always want a grid of 4 windows, here's a command you could use: (defun split-4-ways () (interactive) (delete-other-...
glucas's user avatar
  • 20.6k
9 votes
Accepted

Remapping C-x C-b to Open List of Buffers in Same Window

I highly recommend using ibuffer in place of the default list-buffers command. This will provide not only the behaviour you're after, but also a tremendous amount of additional functionality in terms ...
phils's user avatar
  • 51.2k
9 votes
Accepted

Open org link in the same window

The behaviour for opening files is set in org-link-frame-setup. By default, the behaviour for opening files is file-find-other-window. The following two alternative commands will change that so that ...
Peter Prevos's user avatar
8 votes

desktop-save-mode fails to save window layout

In order for desktop-read (the function used to restore your desktop from a file) to restore the frameset that was saved in the desktop, it must call desktop-restoring-frameset-p (i.e., "should I ...
cyberbisson's user avatar
8 votes
Accepted

save-excursion doesn't restore the currently visible buffer?

The current buffer need not be visible in a window. You're looking for save-window-excursion (or quite possibly a combination of the two). n.b. C-uC-ha ^save- will point out all of the following: ...
phils's user avatar
  • 51.2k
8 votes

Open helm search result in a new window?

C-z will bring up a new buffer with actions available to helm, and I see the following: [f1] Open file [f2] Open file other window [f3] Save results in buffer [f4] Edit search results So you want C-...
Mitchell Tracy's user avatar
8 votes
Accepted

Prefer vertical splits over horizontal ones

In my experience this is a harder problem that one might think, because one's intuitive idea of what is sensible is not always easy to put in precise terms. I'll just describe what I've ended up with, ...
Paul Stanley's user avatar
7 votes
Accepted

One window per project

You can use perspective to manage projects. From its README: perspective.el provides multiple workspaces (or "perspectives") for each Emacs frame. This makes it easy to work on many ...
cutejumper's user avatar
7 votes

How can I adjust the fixed-width of a Neotree buffer?

You can disable neo-window-fixed-size and restart Neotree.
Blaz's user avatar
  • 199
7 votes

Open org link in the same window

This works for me: (setq org-link-frame-setup '((vm . vm-visit-folder-other-frame) (vm-imap . vm-visit-imap-folder-other-frame) (gnus . org-gnus-no-new-news) (file . find-file) ...
Edman's user avatar
  • 1,207
6 votes

Single mode line for all windows

I've finally achieved this by hacking emacs. You can get the source code from https://github.com/amosbird/emacs/tree/onemodeline . Basically it uses mini-window's header line to render current ...
Amos's user avatar
  • 466
6 votes

How can I pin the *compilation* buffer to never leave a single frame/window

Normally, Emacs considers the selected frame the only reusable frame. In other words, normally Emacs only searches the current ("selected") frame for windows that already contain the buffer-to-display ...
bmag's user avatar
  • 1,713
6 votes
Accepted

How can I prevent gdb *input/output* buffer from aggressively popping up in frame?

As soon as emacs 25 lands, there will be a variable gdb-display-io-nopopup to fix this problem
ajp's user avatar
  • 393
6 votes

How to cycle between two windows when I have more than two open?

If you are already using ace-window, then you can use the command aw-flip-window to flip back and forth between two windows. By default this is bound to n in the ace-window aw-dispatch-alist. That ...
glucas's user avatar
  • 20.6k
6 votes
Accepted

How to cycle between two windows when I have more than two open?

One way to write your own command is to use the built in get-mru-window function. For example: (defun my-flip-window () (interactive) (let ((win (get-mru-window nil nil t))) (when win (...
glucas's user avatar
  • 20.6k
6 votes
Accepted

What is the name of the package for quickly switching between windows by using some key and then a, b, c or d?

ace-window provides this function.
Tyler's user avatar
  • 22.3k
6 votes
Accepted

Prevent mouse-3 on mode-line from closing the window

To unbind it: (global-set-key [mode-line mouse-3] nil) To bind it to a different command: (global-set-key [mode-line mouse-3] 'my-favorite-command) How did I find this? C-h k, then right-click ...
Drew's user avatar
  • 77.5k
6 votes

How to set up custom layout for spacemacs?

You can easily save and load layouts in spacemacs: create your layout with SPC l l split and open the files you need, resize to taste etc. press SPC l s. Choose a name for your layout and confirm ...
Dionysis's user avatar
  • 328

Only top scored, non community-wiki answers of a minimum length are eligible