unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: server-start preempted by other emacs window
Date: Wed, 28 Jan 2004 18:33:26 GMT	[thread overview]
Message-ID: <jwv8yjskk8o.fsf-monnier+gnu.emacs.help@asado.iro.umontreal.ca> (raw)
In-Reply-To: m3vfmwxc98.fsf@cisco.com

> 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	other threads:[~2004-01-28 18:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-28 16:34 server-start preempted by other emacs window John Russell
2004-01-28 18:33 ` Stefan Monnier [this message]
2004-01-28 20:33   ` John Russell
2004-01-29 16:52     ` Stefan Monnier
2004-01-29 18:39   ` Thorsten Bonow
2004-01-29 21:11     ` kgold
2004-02-08  9:50     ` Jari Aalto+mail.linux
2004-01-28 18:43 ` Kevin Rodgers
2004-01-28 20:31   ` John Russell
2004-01-29  7:19 ` Klaus Zeitler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv8yjskk8o.fsf-monnier+gnu.emacs.help@asado.iro.umontreal.ca \
    --to=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).