unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Possible to check for (and maybe even connect to) a running server  from elisp?
@ 2009-10-28  3:03 quodlibetor
  2009-10-28  4:54 ` Pascal J. Bourguignon
  0 siblings, 1 reply; 3+ messages in thread
From: quodlibetor @ 2009-10-28  3:03 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: paul.feitzinger

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)?

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.

quodlibetor)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Possible to check for (and maybe even connect to) a running server from elisp?
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Pascal J. Bourguignon @ 2009-10-28  4:54 UTC (permalink / raw)
  To: help-gnu-emacs

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__


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Possible to check for (and maybe even connect to) a running  server from elisp?
  2009-10-28  4:54 ` Pascal J. Bourguignon
@ 2009-10-29 18:50   ` quodlibetor
  0 siblings, 0 replies; 3+ messages in thread
From: quodlibetor @ 2009-10-29 18:50 UTC (permalink / raw)
  To: help-gnu-emacs

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__



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-10-29 18:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).