eminent101 · 2022-08-14 14:46
I start Emacs and run Emacs server like this -
emacs -q
M-x start-server RET
Can I now quit Emacs without stopping the start-server?
flexibeast · 2022-08-14 14:55
Well, you can close the frame with `M-x delete-frame` / `C-x 5 0`. But keep in mind what's in the Emacs manual:
> Run the command ‘server-start’ in an existing Emacs process: either type ‘M-x server-start’, or put the expression ‘(server-start)’ in your init file (*note Init File::). The existing Emacs process is the server; when you exit Emacs, the server dies with the Emacs process.
[deleted] · 2022-08-14 16:47
[deleted]
eminent101 · 2022-08-14 22:48
Didn't work. I got thi error `Attempt to delete the sole visible or iconified frame`
what did you do to make it work?
Atemu12 · 2022-08-15 00:38
Might be better to run the server as a headless daemon and only let clients create frames.
flexibeast · 2022-08-15 00:53
Ah okay, sorry that didn't work .... In my own case, i don't start the server by `start-server` from an existing Emacs process, but instead start it as a daemon, as [mentioned](https://old.reddit.com/r/emacs/comments/wo8295/how_can_i_quit_emacs_without_stopping_emacs/ikbmopu/) by u/Atemu12.
JohnathanDee · 2022-08-15 01:41
This is the way.
If you install from source, keep that latest source directory after `make` and `make install` ... It's still useful until you upgrade!
Edit the included `systemd` config file in the `etc` directory, and save it into your user's or system's `systemd` config directory.
Then you can do one of:
sudo systemctl enable emacs # system service
systemctl --user enable emacs # user service
flexibeast · 2022-08-15 08:19
As an aside, and since the OP didn't mention that they were on a systemd-based system, not all systems on which Emacs can run are systemd-based: apart from Windows and macOS (on which, admittedly, a user is perhaps less likely to be installing from source), there's the BSD OSes (e.g. OpenBSD, FreeBSD) and various Linux distros (e.g. Void, Alpine, Gentoo unless systemd is chosen specifically).
plm314 · 2022-08-17 11:36
I start emacs -daemon followed by an appropriate emacsclient command. The server stays running for weeks to months typically. I rarely need to start a short emacs session without a server (for testing).