Reputation: 5831
I am wondering if and how it is possible to do the following things in Emacs:
Load a certain file whenever Emacs is opened. In particular, it is a .ORG file located in user's home directory.
Create a certain arrangement of windows within that Emacs frame. The frame is open as a GUI, if that matters. For example, it could be two vertical windows with one of them in-turn split into three smaller windows.
Upvotes: 0
Views: 170
Reputation: 670
This is a somewhat inelegant solution, but you could just have your init file run the exact same commands that you would use to manually achieve your setup (use C-h f
to help look up any keyboard shortcuts whose command names you don't know).
To open a file, you can use the command find-file
(the command run by C-x f
). You can use split-window-right
and split-window-below
(C-x 2
and C-x 3
, respectively) to split your window. (It should be noted that there is a more general split-window
command, but I'm avoiding it here since I am just replicating what Emacs would do if we set everything up manually.) The command other-window
(C-x o
) changes windows within a frame - note that this function requires an input argument (the number of windows to go over) when not used interactively.
You could obtain a setup similar to what you were asking about (org file on left, 3 horizontal splits on right, all separate empty buffers) with the following:
(find-file "ABSOLUTE-PATH-TO-FILE.org")
(split-window-right)
(other-window 1)
(split-window-below)
(switch-to-buffer "Fresh-Buffer-1")
(other-window 1)
(split-window-below)
(switch-to-buffer "Fresh-Buffer-2")
(other-window 1)
(switch-to-buffer "Fresh-Buffer-3")
(balance-windows)
(other-window 1)
You may also want to use the functions set-frame-height
and/or set-frame-width
to give yourself an appropriately sized frame (example usage (set-frame-width (selected-frame) 120)
). Additionally, I'd recommend putting this at the end of your init file so that the modes of the buffers you are creating can't interfere with any of your other init functions.
Upvotes: 2