1

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?

  • When you say "split vertically" do you mean that the frame is split into two windows side-by-side or one above the other? – NickD Aug 2 at 3:05
1

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.

| improve this answer | |

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.