简体   繁体   中英

How to open a file in emacs from the terminal without a new instance of emacs opening?

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

If emacs is already running, you can start a server ( Mx 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 fed ) to always enable the server.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM