From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Hugo Heden Newsgroups: gmane.emacs.help Subject: Re: Daemon and client: Only open new frame if there isn't one already? Date: Fri, 13 Mar 2009 12:08:26 +0100 Message-ID: <2bdf908c0903130408t23772cfex48b4d1abf2afccb9@mail.gmail.com> References: <2bdf908c0903121552i28e1da76t8f47975f2ff820ab@mail.gmail.com> <90717509-0527-434D-94F0-5BA9B979FB8F@Web.DE> <2bdf908c0903121644u7e8c01a2nb96d0200c83d2319@mail.gmail.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 1236942551 20557 80.91.229.12 (13 Mar 2009 11:09:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 13 Mar 2009 11:09:11 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Eli Zaretskii Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Mar 13 12:10:27 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 1Li5HT-0005y2-Bs for geh-help-gnu-emacs@m.gmane.org; Fri, 13 Mar 2009 12:10:23 +0100 Original-Received: from localhost ([127.0.0.1]:45191 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Li5G5-0007ha-5b for geh-help-gnu-emacs@m.gmane.org; Fri, 13 Mar 2009 07:08:57 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Li5Fj-0007hC-Lt for help-gnu-emacs@gnu.org; Fri, 13 Mar 2009 07:08:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Li5Fe-0007g9-Vr for help-gnu-emacs@gnu.org; Fri, 13 Mar 2009 07:08:35 -0400 Original-Received: from [199.232.76.173] (port=54686 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Li5Fe-0007g6-TT for help-gnu-emacs@gnu.org; Fri, 13 Mar 2009 07:08:30 -0400 Original-Received: from mail-fx0-f176.google.com ([209.85.220.176]:60875) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Li5Fb-00021T-Hi; Fri, 13 Mar 2009 07:08:27 -0400 Original-Received: by fxm24 with SMTP id 24so2716704fxm.42 for ; Fri, 13 Mar 2009 04:08:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=q2VEkdYLm/Xu3S88McVesGYTI83rZwCcB0kub1gldog=; b=p7TVglC9bX1gQMTzZ73ivG4CG4bkwFbMrAdmLtUOuNVWK8RU00hdDko00QPaO39xEx jg8+LOPjdpmZqICEU+H8EAuUEFbfj5TclWBsbQN3wVVnw+IqBLip3K2905beZ1cBShyS U34rQh7albAoYSdY0OXCBKv/GjK9sIwRGrzAE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=iv1L35qck5yZuusDJeTMjs8yE4VVt9oTRYZ7pByd/pXq7XL+0xmyCndqJsTjXTWQRr 930a78A/k4W+TU3WxLIkFaAGOlojFjB3UBaVakeB0UZgKIaIIDeMbMvwuJMmPorMSEMu TNPPUmpmp71sQg8n3HQdwV3u8+pUpFCPyUT88= Original-Received: by 10.86.66.19 with SMTP id o19mr589299fga.7.1236942506508; Fri, 13 Mar 2009 04:08:26 -0700 (PDT) In-Reply-To: X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) 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:62879 Archived-At: On Fri, Mar 13, 2009 at 10:35 AM, Eli Zaretskii wrote: >> Date: Fri, 13 Mar 2009 00:44:25 +0100 >> From: Hugo Heden >> Cc: help-gnu-emacs@gnu.org >> >> >> Is there a way for emacsclient to ask the daemon to make a new frame >> > >> > Have you invoked >> > >> > =A0 =A0 =A0 =A0emacsclient --help >> > >> > Yes, in GNU Emacs 23.0.91 it can! >> > >> >> Yes, thanks Peter, I have, but this is not what I want to do: >> =A0 "-c, --create-frame Create a new frame instead of trying to use the >> current Emacs frame" >> >> What I want is a command line option (or some hacky script ) to >> automatically create a new frame only if there is no frame currently >> open. If there is a frame already, that frame should automatically be >> reused. > > But the above portion of the emacsclient help message seems to mean > that emacsclient already does what you want by default. =A0That's why > you need the -c option to override that default and create a new > frame even if one already exist. > > Doesn't the default work for you? =A0Perhaps you should report a bug, > then. > Thanks all! I have diffuculties explaining what I am looking for. 1) I already have a daemon running, so that is not the problem. (Yes, the alternate-editor option is good for that) 2) The --create-frame option creates a new frame yes, but it does so every time the option is used. And that is a problem for me :-) I want max *one* frame open at any given time! 3) Ok ok -- I *could* use my brain to manually do this: if( there-is-a-frame-currently-open ) open-the-file-*without*-the-[--create-frame]-option else open-the-file-*with*-the-[--create-frame]-option endif --that would achieve what I am looking for. 4) But that would be a little to much waste of brain power! My problem is that I do not want to have to remeber whether I already have a frame open or not. The if-statement above is just too much for me to bare. So I would want to write a little script that *autoamtiaclly* achieve the above logic.. The cleanest solution would be to always invoke emacsclient with an --eval option, something like this: emacsclient --eval "( unless( x-display-list ) make-frame ) " or this: emacsclient.emacs-snapshot --eval "(unless(x-display-list)(new-frame))" -- but I can't figure out how to write that eval (neither of the above will work).. 5) This is similar to how I use Firefox: When I click on a link in a mail, that link opens in a new tab in a currently existing frame.. unless there isn't one, in which case a new frame is automatically opened. Hmm, is this clearer? Any ideas? Best regards Hugo Heden