I am trying to write an Elisp function that will create a new frame and in that new frame open two files split vertically.
I have been unable to find anything about this in the Elisp manual, node Creating Frames
How can I do this?
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.
Sign up to join this communityI am trying to write an Elisp function that will create a new frame and in that new frame open two files split vertically.
I have been unable to find anything about this in the Elisp manual, node Creating Frames
How can I do this?
You can try this function:
(defun my/open-files-vert-in-new-frame (file1 file2)
(interactive "f\nf")
(select-frame-set-input-focus (make-frame))
(find-file file1)
(split-window-below)
(find-file file2))
The key is select-frame-set-input-focus
which makes subsequent functions operating on windows of the new frame and set input focus on it.