From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: quodlibetor Newsgroups: gmane.emacs.help Subject: Re: Possible to check for (and maybe even connect to) a running server from elisp? Date: Thu, 29 Oct 2009 11:50:14 -0700 (PDT) Organization: http://groups.google.com Message-ID: <0da08f00-c50a-44f5-841f-86d3fdcf9296@f18g2000prf.googlegroups.com> References: <0fbaadb5-a245-4a6b-b6db-5758da722266@b2g2000yqi.googlegroups.com> <8763a0rucf.fsf@galatea.local> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1256845249 17439 80.91.229.12 (29 Oct 2009 19:40:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 29 Oct 2009 19:40:49 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Oct 29 20:40:42 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 1N3arR-0007Af-H9 for geh-help-gnu-emacs@m.gmane.org; Thu, 29 Oct 2009 20:40:41 +0100 Original-Received: from localhost ([127.0.0.1]:55803 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N3arR-00004u-0W for geh-help-gnu-emacs@m.gmane.org; Thu, 29 Oct 2009 15:40:41 -0400 Original-Path: news.stanford.edu!usenet.stanford.edu!postnews.google.com!f18g2000prf.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 44 Original-NNTP-Posting-Host: 146.95.21.76 Original-X-Trace: posting.google.com 1256842214 29286 127.0.0.1 (29 Oct 2009 18:50:14 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Thu, 29 Oct 2009 18:50:14 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: f18g2000prf.googlegroups.com; posting-host=146.95.21.76; posting-account=-bGvIQoAAABPJI7xhxUa9jLKxm0Tx_GX User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.3) Gecko/20090910 Ubuntu/9.04 (jaunty) Shiretoko/3.5.3, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:174256 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:69338 Archived-At: I guess I could manually check for a server-file in /tmp/emacs1000/ or something. Which is exactly as difficult as a function that just tells me if the server is running. But, Using `emacsclient -c -a emacs -e '(org-agenda-list)' seems to work pretty amazingly. So I'll probably just do that. Thanks. On Oct 28, 12:54=A0am, p...@informatimago.com (Pascal J. Bourguignon) wrote: > 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: > > =A0 =A0(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: > > =A0 =A0 =A0emacsclient -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__