How to open a file in an existing emacs process from command line

command lineemacs

I have several script that will launch all the apps and files related to a specific project. But, it will launch multiple emacs instances, rather than simply cause the current emacs to open the requested files. I'd rather the current emacs simply opened the project text files in a new buffer.

Any ideas how I can do that?

Best Answer

M-x server-start inside the Emacs session, then use emacsclient -n file1 file2 ... to add files to the existing Emacs. There are additional options you might want to use, e.g. -c to open the files in a new window (frame).

Related Question