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 f


From: Pascal J. Bourguignon
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
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.3 (darwin)

quodlibetor <quodlibetor@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]