1

Does anyone know why my terminal opens a new instance of emacs whenever I run emacs "filename" from my terminal?

My google results about the issue showed too many occurrences of people trying to do this liberately, but my emacs is doing this by default for some reason.

I've found no resolving cases in my init.el or ~/.zshrc

2
  • Why don't you open the file directly from within emacs, if it is running already? Commented Jan 18, 2021 at 15:39
  • 1
    I do that aswell but what I was looking for is the emacsclient command. Commented Jan 19, 2021 at 14:51

2 Answers 2

3

If emacs is already running, you can start a server (M-x start-server) from within emacs, and open files with emacsclient on the command line. You may create an alias for that.

Spacemacs has a dotspacemacs-enable-server setting in your init.el file (SPC f e d) to always enable the server.

Sign up to request clarification or add additional context in comments.

1 Comment

That's right, I was looking for the emacsclient command. Thanks.
0

This is a pretty normal default behavior for any program. If you have a cat process running in one terminal, and you run cat again in another, they're not going to somehow share: you get two copies of cat running. The same thing applies to emacs. There are configuration options to change this, basically by making the first instance of emacs act as a server. Then the second emacs still starts a new process, but instead of continuing to set up a brand new editor it just sends information to the server process.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.