Reputation: 33
I want to start three files in emacs from a terminal, and split the window in emacs into three, so that the three windows contains one file each. It is also important to me that the windows is divided in a certain way. I can get the right split manually by opening emacs, and pressing C-x 3, C-x o, C-x 2. Anyone knows how to do this either by configurating .emacs or by bash-scripting? I am to open about 300 files this way, so doing it automatically would help me out a lot.
EDIT: I am to open 3 different files each time. I would love if I could open from terminal like this: emacs file1 file2 file3
then for the next three files emacs file4 file 5 file6
Just in case: - Running Linux - Using emacs-newest
Upvotes: 3
Views: 267
Reputation: 13452
Does this do what you want?
(defun open-files (first second third) (interactive "fFirst: \nfSecond: \nfThird: ") (find-file first) (split-window-horizontally) (other-window 1) (find-file second) (split-window-vertically) (other-window 1) (find-file third))
Edit: I've made the function interactive, it is also possible to call it from the command line like so:
emacs --eval='(open-files "/tmp/first" "/tmp/second" "/tmp/third")'
You could probably wrap this in a bash script to make it easier to call.
Upvotes: 4