When strike C-x 3, a new window and buffer will open to the right of the current buffer.

How could set it open to the left of the current?

  • You mean you want the selected window being the one on the right?
    – JeanPierre
    Nov 19, 2019 at 6:32
  • Yes, I want my focus window on right and the new opened window to its left. @JeanPierre
    – Wizard
    Nov 19, 2019 at 6:42
  • Here is an example of how to display a buffer in any one of four directions, i.e., above, below, left, and right: stackoverflow.com/a/50867710/2112489
    – lawlist
    Nov 19, 2019 at 6:49

2 Answers 2


C-x 3 is bound to the function split-window-right, that splits the current window horizontally, selecting the left window. We can define a function split-window-left that calls it then change the selected window to the one on the right, eg using other window:

other-window is an interactive compiled Lisp function in ‘window.el’.

(other-window COUNT &optional ALL-FRAMES)

Select another window in cyclic ordering of windows. COUNT specifies the number of windows to skip, starting with the selected window, before making the selection.

(defun split-window-left (&optional size)
  "Like split-window-right, with selected window on the right."
  (interactive "P")
  (split-window-right size)
  (other-window 1))

We keep the same semantics for the optionalsize argument: give the width of the left window if positive, of the right one if negative.

You can bind this to C-x 3 (overriding the binding to split-window-right) or to another key, eg C-x 9:

(global-set-key  "\C-x9" 'split-window-left)

This might do the trick, and it's built in:


Split the window horizontally and focus the new window.

  • Unfortunately this function does not take a SIZE parameter. Mar 13, 2022 at 5:36
  • Can't find this function. Where is it defined? (I'm using emacs 26.1 so it may be too old...)
    – JeanPierre
    Mar 13, 2022 at 15:50
  • keybindings.el. I'm on Emacs 27.2 so maybe it's a newer function? Mar 13, 2022 at 16:44
  • Oops! I was looking through the source code, and this is part of Spacemacs! My fault @JeanPierre. Mar 13, 2022 at 16:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.