help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: server-start preempted by other emacs window


From: Stefan Monnier
Subject: Re: server-start preempted by other emacs window
Date: Wed, 28 Jan 2004 18:33:26 GMT
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

> Is there a way to have emacs check to see if another server process
> is running before it runs server-start?

Not really.  It's pretty tricky to do.
One way is to see if the socket file is present in /tmp.
But then it might be left over from a previous Emacs that's not running
any more.  You could try and make sure that Emacs removes the socket file
when it exits, but if it crashes, you're still left with a dead socket in
/tmp.
A more robust way is to check whether you can connect to the socket.
In Emacs-CVS you could do that with make-network-stream.

But what people usually do is that they do not start-server automatically
for each and every Emacs process, instead they either do it manually for
the Emacs process they care about, or they do it via arguments passed to
Emacs when starting up.
E.g. I start my main emacs as `emacs-server' which is an alias for
something like `emacs -geometry AxB+C+Z -f my-server-mode' where
my-server-mode is a function defined in my .emacs that calls server-start
and does a few other things that I only want done in my main Emacs but not
in the Emacs I use to read Gnus, e.g.


        Stefan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]