unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Thorsten Bonow <thorsten.bonow@post.rwth-aachen.de>
Subject: Re: automatic selection of emacsclient/emacs?
Date: Wed, 08 Jun 2005 10:00:58 +0200	[thread overview]
Message-ID: <87k6l5e0qt.fsf@herrrossi.mmweg.rwth-aachen.de> (raw)
In-Reply-To: 2cydneqEPbdzxTvfRVn-uw@speakeasy.net

>>>>> "Hattuari" == Hattuari  <susudata@setidava.kushan.aa> writes:

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

Hi,

this has been asked before and several solutions/approaches have been
posted. Try googling around for them.

One is already coming with GNU Emacs: There are emacs.bash/emacs.csh scripts in
the etc sub-directory of the source tree which should do in principal what you're
trying to achieve.

    Hattuari> It would seem more correct to directly check to see if the service
    Hattuari> is available.  Is there such a capability?

For this you could try something like

    emacsclient --eval t > /dev/null 2>&1
    echo $?

The exit status $? is only 0 if the client was able to connect to an running
emacs server.

Hope this helps.

For ages now I'm working on a little script which tries to solve this problem in
a more general way (supporting both GNU Emacs/emacsclient and XEmacs/gnuclient),
making it possible to start a mail/news reader from it, open up a new frame/tty
etc. Never got around finishing it since leaving university [7 years ago :-)]

It's basically working, but not nearly finished. If you're interested I can mail
it to you.

Toto

-- 
Contact information and PGP key at
http://www-users.rwth-aachen.de/thorsten.bonow

[Featured Creature]

NAME: Oscar the Grouch

BIO/STATS: Built in 1969, Oscar was originally orange but was changed
           to green very early in his career. He was the first grouch
           in what is now a very large family of grouches.

APPEARANCES: Sesame Street, The Adventures of Elmo in Grouchland, and
             many specials and home videos.

FAMOUS FOR: Living in a trashcan and having a pet elephant and worm.

SPECIAL TALENTS: Being Grouchy, says "Go Away!" losing his patience.

  parent reply	other threads:[~2005-06-08  8:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-08  2:32 automatic selection of emacsclient/emacs? Hattuari
     [not found] ` <2cydneqEPbdzxTvfRVn-uw-zY4eFNvK5D9If6P1QZMOBw@public.gmane.org>
2005-06-08  7:56   ` Jochen Küpper
2005-06-08  8:00 ` Thorsten Bonow [this message]
2005-06-08  9:17 ` David Kastrup
2005-06-12 14:29 ` Dan Elliott
2005-06-12 18:19   ` Floyd L. Davidson
2005-06-13 15:29   ` Drew Adams
2005-06-13 18:27   ` kgold
2005-06-12 20:28 ` Benjamin Rutt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k6l5e0qt.fsf@herrrossi.mmweg.rwth-aachen.de \
    --to=thorsten.bonow@post.rwth-aachen.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).