Hattuari <[EMAIL PROTECTED]> writes:

> Is there a clean way to get Emacs to start as a client when there is
> an available server?  I find it moderately annoying to have to look
> around to see if there is already an instance of Emacs started in
> order to determine if I should enter `emacs' or `emacsclient'. I
> much prefer running emacsclient when I already have one instance of
> Emacs running.  One option is to try and sniff for emacs with ps and
> filter out the current processes such as grep emacs, and (assuming
> the script I'm running is also called emacs) the launch script.  It
> would seem more correct to directly check to see if the service is
> available.  Is there such a capability?

(info "(emacs) Invoking emacsclient")

[...]

   The option `--alternate-editor=COMMAND' is useful when running
`emacsclient' in a script.  It specifies a command to run if
`emacsclient' fails to contact Emacs.  For example, the following
setting for the EDITOR environment variable will always give you an
editor, even if no Emacs server is running:

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

The environment variable ALTERNATE_EDITOR has the same effect, but the
value of the `--alternate-editor' takes precedence.

   Alternatively, the file `etc/emacs.bash' defines a bash function
which will communicate with a running Emacs server, or start one if
none exists.


-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum
_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

Reply via email to