help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Possible to check for (and maybe even connect to) a running server


From: quodlibetor
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)
User-agent: G2/1.0

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 via email to

[Prev in Thread] Current Thread [Next in Thread]