How to avoid the message of "server-start" while opening another Emacs session?
Asked Answered
Q

1

21

I have a line (server-start) in my .emacs for some reasons. Everything is fine when I launch a first session of Emacs, but when I open anther session, there is a buffer which shows:

Warning (server): Unable to start the Emacs server.
There is an existing Emacs server, named "server".
To start the server in this Emacs process, stop the existing
server or call `M-x server-force-delete' to forcibly disconnect it.

As I quite often open several Emacs, I am wondering if it is possible modify `.emacs' file so as to avoid this message in the beginning.

Could anyone help? Thank you very much!

Queenhood answered 18/6, 2011 at 16:25 Comment(1)
the point behind using the server-start is that this way you run emacs only once and as a server. next each time you need emacs, you actually run emacsclient and it connects to the already running emacs server. Also I dont think its a good practice to have anything in your config files, unless you know what its there for.Crookback
T
35

Try:

(require 'server)
(or (server-running-p)
    (server-start))

Note that server-running-p does not appear in the manual, so conceivably this could break with future versions of Emacs.

Talamantes answered 18/6, 2011 at 16:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.