all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: quodlibetor <quodlibetor@gmail.com>
To: help-gnu-emacs@gnu.org
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)	[thread overview]
Message-ID: <0da08f00-c50a-44f5-841f-86d3fdcf9296@f18g2000prf.googlegroups.com> (raw)
In-Reply-To: 8763a0rucf.fsf@galatea.local

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 am, p...@informatimago.com (Pascal J. Bourguignon)
wrote:
> quodlibetor <quodlibe...@gmail.com> 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__



      reply	other threads:[~2009-10-29 18:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-28  3:03 Possible to check for (and maybe even connect to) a running server from elisp? quodlibetor
2009-10-28  4:54 ` Pascal J. Bourguignon
2009-10-29 18:50   ` quodlibetor [this message]

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

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

  git send-email \
    --in-reply-to=0da08f00-c50a-44f5-841f-86d3fdcf9296@f18g2000prf.googlegroups.com \
    --to=quodlibetor@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.