Arash
Arash

Reputation: 568

How visit a file in a new frame

When programmin in Elisp, how can I visit a new file in a new frame and switch focus on that? -- I mean after doing some stuff in a function I create a file "test.xml", At the end of my function I want to open this xml file in a new frame and show it to the user. I have tried something like the following but when executed shows a blank buffer:

(defun transform-file-on-save ()
...
 (new-file-name (concat  (buffer-file-name) ".xml"))
...
(write-region (point-min) (point-max) new-file-name nil 'quietly)
 (switch-to-buffer-other-window new-file-name)

Upvotes: 2

Views: 154

Answers (1)

Daniel
Daniel

Reputation: 641

Use (find-file-other-frame FILENAME &optional WILDCARDS) instead of switch-to-buffer-other-window new-file-name)

Upvotes: 2

Related Questions