From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: server-start preempted by other emacs window Date: Wed, 28 Jan 2004 18:33:26 GMT Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1075317791 28946 80.91.224.253 (28 Jan 2004 19:23:11 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 28 Jan 2004 19:23:11 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jan 28 20:22:54 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AlvH3-0004Wf-00 for ; Wed, 28 Jan 2004 20:22:53 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AlvBU-0006SS-SK for geh-help-gnu-emacs@m.gmane.org; Wed, 28 Jan 2004 14:17:08 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!worldnet.att.net!207.35.177.252!nf3.bellglobal.com!snoopy.risq.qc.ca!charlie.risq.qc.ca!53ab2750!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 24 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 Original-NNTP-Posting-Host: 132.204.24.84 Original-X-Complaints-To: abuse@umontreal.ca Original-X-Trace: charlie.risq.qc.ca 1075314806 132.204.24.84 (Wed, 28 Jan 2004 13:33:26 EST) Original-NNTP-Posting-Date: Wed, 28 Jan 2004 13:33:26 EST Original-Xref: shelby.stanford.edu gnu.emacs.help:120519 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:16467 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:16467 > 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