If I open 2 files by command line:

emacs file1 file2

in Emacs 25.3.2, file2 is opened in the upper window and file1 in the lower.

enter image description here

This didn't happen in previous versions of Emacs that had the correct (in my opinion) behaviour (file1 was open in the upper window and file2 in the lower).

Can I restore the old behaviour?


Add the following to you init.el file.

;; 15-Oct-20  wr  open first file in left window
(defun my-startup-layout ()
  (let ((buffers (mapcar 'window-buffer (window-list))))
    (when (= 2 (length buffers))
      (set-window-buffer (split-window-horizontally) (cadr buffers))))

(add-hook 'emacs-startup-hook 'my-startup-layout)
(add-hook 'emacs-startup-hook 'next-multiframe-window)
;; end of customization to open first file on left

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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