2

When opening emacs with two files $ emacs a.txt b.txt, the window splits vertically.

I need to have a horizontal split instead. Is there a variable that controls this behavior or is there a hook where I can override the one behavior without changing other behaviors as well?

I've looked at related questions on StackOverflow but they had a different focus and their answers weren't directly applicable:

I would like to find the specific code runs when emacs is opened and change just the one call to (split-window-vertically).

In case it matters, I'm using GNU Emacs 24.3.1.

4

3 回答 3

2
emacs -Q a.txt -eval "(split-window-horizontally)" -eval "(find-file \"b.txt\")"

Maybe set some font too, for example Liberation Mono-18:

emacs -Q a.txt -eval "(split-window-horizontally)" -eval "(find-file \"b.txt\")" --font 'Liberation Mono-18'

Without option -Q load your init-file also.

Well, just for completeness, when at a file already: C-x 3

于 2013-10-04T16:49:14.623 回答
2

The specific code to open files from the command line is in startup.el. The function is command-line-1 and it calls find-file-other-window (in two different places).

You should be able to do something like this in your .emacs, but I'm not sure about the details:

(defadvice find-file-other-window (before split (file &optional wildcards))
  (if <during command line processing>
      (split-window-horizontally)))
(ad-activate 'find-file-other-window)
于 2013-10-04T17:47:49.490 回答
0

There's an option to transpose vertical/horizontal split. Very convenient and fun.

于 2013-10-04T16:22:18.387 回答