Here's my intended use case:

Emacs Instance 1: I have an emacs instance containing open buffers of the project I'm working on. All directly related.

Emacs Instance 2: I'm in the Windows explorer, and I'm looking at a bunch of local files (for reference) that are not directly related to my project. I'd like to double click on these files and have all of the files open on Emacs Instance 2. This way, these reference files don't clutter up my other instance, and all referenced files are grouped together in a single frame (think Notepad++, when you double click a file, it uses the same instance and creates a tab for all open files).

The flow would be something along the lines of

  1. Emacs is already open with a buffer list of just buffers related to project ("Emacs Instance 1")
  2. Open up a file manager (repository, Windows Explorer, or Mac OS X Finder), browse to a file, and double click
  3. Check for instance of "Emacs Instance 2". If not available, then create a new instance and open the file there. If it is, then open the buffer on this existing instance.

Is the above behavior possible?

Note: I call out a separate instance of Emacs because as far as I can tell, that's the only way to keep the buffer list filtered. If there's a way to use the same instance, but keep the buffer list filtered to that specific frame, that works just as well for me!

  • 1
    Yes, it is possible. I have implemented such a feature for OSX from the Finder.app, but I have never tried using the example with Windows Explorer. There is probably a parallel function in Emacs for recognizing incoming files from Windows Explorer -- for example, on OSX the function is ns-find-file. The following link contains a detailed example for opening files in specific frames if they exist, or creating the frame if it does not: stackoverflow.com/a/18371427/2112489 I will only be maintaining/updated one thread from time to time, so that answer will not be duplicated here.
    – lawlist
    Apr 5, 2015 at 17:19
  • To associate buffers with a specific frame -- i.e., so that Emacs remembers which buffers are associated with a particular frame -- and to weave that concept into the one mentioned above at that related link, the original poster may wish to consider using the frame-bufs library written by Alp Aker: github.com/alpaker/Frame-Bufs The function frame-bufs--add-buffer would be used at key locations within the display-buffer function in the link of the comment above -- such that when the file is displayed in the particular frame, said buffer is automatically associated with said frame.
    – lawlist
    Apr 5, 2015 at 17:28
  • And to tie it all together if the original poster likes using tabs, the following link demonstrates how to marry tabbar.el with frame-bufs.el: emacs.stackexchange.com/a/10112/2287
    – lawlist
    Apr 5, 2015 at 17:33
  • It's not clear, to me, what you are asking. When you write "Emacs instance N" do you mean a separate Emacs session (instance)? Or do you mean, as your title suggests, a separate Emacs frame (in the same session)? As it stands now, this risks being closed as unclear.
    – Drew
    Apr 5, 2015 at 19:10
  • @lawlist thanks for pointing me to this page. At first, your initial response didn't quite fit my use case (because I wasn't clear in my initial post). But, as I read your other responses, your solution seems to be what I'm looking for. My goal was just a mechanism to open buffers in a specific "window" and allow for a way to keep the buffer list separate (to avoid cluttering my main project). If you'd like to post this as an answer, I can accept it after a couple of days so that others can provide suggestions if they have any
    – cheezy
    Apr 5, 2015 at 20:20

1 Answer 1


With two separate instances

Start the Emacs server in instance 2. Don't start it, or start it with a non-default name, in instance 1.

For example, put (server-start) in your init file. Launch instance 2 normally, with emacs (or let emacsclient do it). Launch instance 1 with emacs --eval "(setq server-name \"work\")".

  • This worked really well for me. Accepting this since lawlist's works too, but he wants to maintain a single thread for his answers.
    – cheezy
    Apr 7, 2015 at 1:06

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.