From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: jem Newsgroups: gmane.emacs.help Subject: Re: emacsclient frame reuse Date: Tue, 4 Aug 2009 17:22:13 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <1c9c248b-a2e4-441a-9bd7-5ca49bc7694c@c1g2000yqi.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1249446061 9976 80.91.229.12 (5 Aug 2009 04:21:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 5 Aug 2009 04:21:01 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Aug 05 06:20:55 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MYXzf-0004wF-Fa for geh-help-gnu-emacs@m.gmane.org; Wed, 05 Aug 2009 06:20:51 +0200 Original-Received: from localhost ([127.0.0.1]:33252 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MYXze-0003Od-TU for geh-help-gnu-emacs@m.gmane.org; Wed, 05 Aug 2009 00:20:50 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!news2.glorb.com!postnews.google.com!j32g2000yqh.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 33 Original-NNTP-Posting-Host: 71.28.31.149 Original-X-Trace: posting.google.com 1249431733 21928 127.0.0.1 (5 Aug 2009 00:22:13 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 5 Aug 2009 00:22:13 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: j32g2000yqh.googlegroups.com; posting-host=71.28.31.149; posting-account=uQI20AoAAADpGc1FO8dUEAsKl32pIiX7 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.12) Gecko/2009070811 Ubuntu/9.04 (jaunty) Firefox/3.0.12, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:171576 X-Mailman-Approved-At: Wed, 05 Aug 2009 00:18:42 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:66757 Archived-At: On Aug 4, 6:18=A0pm, "A.Politz" wrote: > On Aug 4, 11:07=A0pm, jem wrote: > > > How can you detect if there is already a running frame with the newest > > version? > > > Thanks > > > Jere > > ~ > > #!/bin/sh > > EMACS=3Demacs-23.1 > EMACSCLIENT=3Demacsclient-23.1 > FLAGS=3D-n > > $EMACSCLIENT -e nil >/dev/null || $EMACS --daemon > > NR_FRAMES=3D$($EMACSCLIENT -e '(1- (length (frame-list)))') > > if [ $NR_FRAMES -eq 0 ];then > =A0 =A0 FLAGS=3D"$FLAGS -c" > fi > > $EMACSCLIENT $FLAGS "$@" > > There seems to be an invisible frame, representing the daemon or > something. Thanks, this works quite well. Jere