11

I started a Emacs in my terminal, and then started running Emacs server inside it by M-x server-start. Now I would like to cancel running the Emacs server without exiting the Emacs process. There seems to be no command for that. How can i do that? Thanks.

Tim
  • 101,790

2 Answers2

13

The command to do that from inside emacs is

M-x server-mode

The first time you run it, it'll restart the server it's running. The second time, it'll stop the server.

To make sure that you're stopping the server, pass a non-positive prefix argument: M-0 M-x server-mode RET

Jenny D
  • 13,172
  • 1
    Thanks. what is the difference between it and M-x server-start for starting the server? – Tim Aug 15 '14 at 06:01
  • 1
    I was wrong at first; it doesn't start the server if it isn't running already, it just restarts it if it is. – Jenny D Aug 15 '14 at 06:02
4

You can stop the server by running server-force-delete, e.g. interactively by doing M-x server-force-delete.

Arne
  • 843
  • In my attempts to use this, it just deletes the socket file that the server is using to accept connections from clients, but the server process continues running. – mtraceur Mar 30 '23 at 22:16