When I open a file externally - through the terminal or the file manager GUI, it opens in a new window.

How can I always open a file in a new buffer of an existing emacs session?


1 Answer 1


Not too clear. Is what you want to open Emacs, from outside Emacs, to edit a file?

If so, use program/command emacsclient or emacs followed by a file name. See the Emacs manual, node Action Arguments and perhaps node Emacs Server.

  • If I do emacs file1.txt followed by emacs file2.txt in the terminal, two separate windows of emacs open file1 and file2 respectively. I would like to check that if an existing window is already open (for file1 in this case), open the next file (file2 in this case) in a new buffer of the current window.
    – Saurabh
    Apr 19, 2020 at 3:26
  • 3
    emacsclient, if you want to reuse the same Emacs session. (And I think maybe you mean "frame" instead of Emacs "window" and Emacs "window" instead of "buffer".)
    – Drew
    Apr 19, 2020 at 4:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.