[Top][All Lists]

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

Re: Detecting if the Emacs server is running

From: Deniz Dogan
Subject: Re: Detecting if the Emacs server is running
Date: Fri, 18 Mar 2011 07:47:55 +0100

2011/3/18 PJ Weisberg <address@hidden>:
> Is there a way, in GNU/Linux, to detect whether Emacs is running in
> server mode from a shell script?
> I'd like to write a script that creates a new frame with emacsclient
> if the user is already running an emacs server, but just starts up a
> regular Emacs instance if he isn't.

See e.g. (info "(emacs) emacsclient Options").

   The other optional arguments recognized by `emacsclient' are listed

     Specify a command to run if `emacsclient' fails to contact Emacs.
     This is useful when running `emacsclient' in a script.  For
     example, the following setting for the `EDITOR' environment
     variable will always give you an editor, even if no Emacs server is

          EDITOR="emacsclient --alternate-editor emacs +%d %s"

     As a special exception, if COMMAND is the empty string, then
     `emacsclient' starts Emacs in daemon mode and then tries
     connecting again.

     The environment variable `ALTERNATE_EDITOR' has the same effect as
     the `-a' option.  If both are present, the latter takes precedence.

Deniz Dogan

reply via email to

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