From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: pjb@informatimago.com (Pascal J. Bourguignon) Newsgroups: gmane.emacs.help Subject: Re: Possible to check for (and maybe even connect to) a running server from elisp? Date: Wed, 28 Oct 2009 05:54:56 +0100 Organization: Informatimago Message-ID: <8763a0rucf.fsf@galatea.local> References: <0fbaadb5-a245-4a6b-b6db-5758da722266@b2g2000yqi.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1256708471 20683 80.91.229.12 (28 Oct 2009 05:41:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 28 Oct 2009 05:41:11 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 28 06:41:04 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1N31HK-0004bH-I5 for geh-help-gnu-emacs@m.gmane.org; Wed, 28 Oct 2009 06:41:02 +0100 Original-Received: from localhost ([127.0.0.1]:34921 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N31HK-0005vZ-0V for geh-help-gnu-emacs@m.gmane.org; Wed, 28 Oct 2009 01:41:02 -0400 Original-Path: news.stanford.edu!usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 36 Original-X-Trace: individual.net pLK+mZgNrwMGrc5/o/i79wma8868DEGecYVkkRhv2ujYD8JVAJ Cancel-Lock: sha1:ZDAxYTRmNTFmZjgyNTQ2NjM3ZmNmNjVlZTdhMTdiZDczMTFjMzFiYQ== sha1:glHj9zqKsBh0UNaUewCX1lp5oxA= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en X-Disabled: X-No-Archive: no User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.3 (darwin) Original-Xref: news.stanford.edu gnu.emacs.help:174215 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:69298 Archived-At: quodlibetor writes: > I have `(server-start)' in my .emacs, and sometimes I forget that I've > got an emacs daemon running or that I started it from a detached > screen instance. > > I would mostly prefer to be able to just connect to a running server > if it exists, but I'm assuming that the existence of emacsclient means > that's not possible. > > Is there, though, a way to at least check if the server is running, so > that I can not call (server-start)? Well, you could configure it to use a per-process socket: (setq server-name (format "server-%d" (emacs-pid))) in ~/.emacs before (server-start). Then you have to pass the -s option to emacsclient, giving it the full pathname of the socket, normally something like: emacsclient -s /tmp/emacs${UID}/server-${EMACS_PID} to address the emacs instance you want. > Or, alternatively, is it possible to start emacscllient without a > file? I normally start into an org agenda-view buffer and choosing a > file to start in is mildly irritating. You can send commands to emacs, using the -e option. -- __Pascal Bourguignon__