From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eddie Hillenbrand Newsgroups: gmane.emacs.bugs Subject: bug#11033: emacsclient: create a new frame only if one doesn't exist Date: Fri, 16 Mar 2012 16:18:33 -0700 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Apple Message framework v1257) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1331940252 5180 80.91.229.3 (16 Mar 2012 23:24:12 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 16 Mar 2012 23:24:12 +0000 (UTC) To: 11033@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Mar 17 00:24:11 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1S8gVH-0007I4-4w for geb-bug-gnu-emacs@m.gmane.org; Sat, 17 Mar 2012 00:24:11 +0100 Original-Received: from localhost ([::1]:43633 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8gVG-0003ZI-Gg for geb-bug-gnu-emacs@m.gmane.org; Fri, 16 Mar 2012 19:24:10 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:56152) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8gUv-0003NQ-1g for bug-gnu-emacs@gnu.org; Fri, 16 Mar 2012 19:24:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S8gUt-00017v-7V for bug-gnu-emacs@gnu.org; Fri, 16 Mar 2012 19:23:48 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:47195) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8gUt-00017q-4B for bug-gnu-emacs@gnu.org; Fri, 16 Mar 2012 19:23:47 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1S8gyA-0008JV-Bz for bug-gnu-emacs@gnu.org; Fri, 16 Mar 2012 19:54:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eddie Hillenbrand Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 16 Mar 2012 23:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 11033 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.133194200131898 (code B ref -1); Fri, 16 Mar 2012 23:54:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 16 Mar 2012 23:53:21 +0000 Original-Received: from localhost ([127.0.0.1]:54027 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S8gxT-0008IQ-QZ for submit@debbugs.gnu.org; Fri, 16 Mar 2012 19:53:20 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:49052) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S8gtb-0008CE-C5 for submit@debbugs.gnu.org; Fri, 16 Mar 2012 19:49:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S8gQH-0000LU-W9 for submit@debbugs.gnu.org; Fri, 16 Mar 2012 19:19:03 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:38439) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8gQH-0000LQ-Sl for submit@debbugs.gnu.org; Fri, 16 Mar 2012 19:19:01 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:47914) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8gQG-0001he-46 for bug-gnu-emacs@gnu.org; Fri, 16 Mar 2012 19:19:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S8gPv-0000GO-MQ for bug-gnu-emacs@gnu.org; Fri, 16 Mar 2012 19:18:59 -0400 Original-Received: from mail-yx0-f169.google.com ([209.85.213.169]:42788) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8gPv-0000Fu-Ij for bug-gnu-emacs@gnu.org; Fri, 16 Mar 2012 19:18:39 -0400 Original-Received: by yenm8 with SMTP id m8so5586700yen.0 for ; Fri, 16 Mar 2012 16:18:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:content-type:content-transfer-encoding:subject:date:message-id :to:mime-version:x-mailer:x-gm-message-state; bh=IkxTQt8BOWyGSrJ38KVrQ+p2FmtvKQpQEt0Hg/hytBM=; b=ncvpQHhSeRC3hZx+66M4jFy7Jvtpz2FjUZZLezrz9QVZtmyU+9u6oS+4ia/m/XWiAX sLffn0GTSyP/16u9BDSZaeg/3iHnATbkK/ntH9zzsngoIH44cs3+ah55KgzPUhMJuBrJ cM8W9TFxrDyb2EARPPmvjkA5Xnd7yHQGbZW2JKTjFMVhfewrhOmvp0S2hH65xvqcMkrk uDPtzrjYav68A0ndywxeO/Xvv8N+41JEEeRQDER9t2nDdiJJ+05VoNjC4NhUnDOD2AlJ 0yQTy3qfcWVDsF3HuimPrYTapt4RVfqpepRslCWchRRNSDWJgzzMRSU5sR1beCd4VY/T J03g== Original-Received: by 10.60.22.10 with SMTP id z10mr5532450oee.16.1331939917888; Fri, 16 Mar 2012 16:18:37 -0700 (PDT) Original-Received: from [10.0.1.15] (71-36-161-107.phnx.qwest.net. [71.36.161.107]) by mx.google.com with ESMTPS id v9sm6103367obo.9.2012.03.16.16.18.35 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 16 Mar 2012 16:18:36 -0700 (PDT) X-Mailer: Apple Mail (2.1257) X-Gm-Message-State: ALoCoQkFE5g79IJo9+ttEODfWxYvQqwHiNLEoSY25lGc0+3eOdNqCVskhHl0oXCS/0vHZDKrtP7c X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Fri, 16 Mar 2012 19:53:18 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:57839 Archived-At: I'm using emacsclient with emacs --daemon, but I find myself wanting a different behavior than the standard options provide. It would be nice if emacsclient could create a window system frame only when one doesn't exist and if one does exist simply reuse that frame. I know I can get this behavior by initially invoking emacsclient with -c and then subsequently invoking it without the -c, however I'd prefer not to think about whether I need to include the -c when opening files. server-window was suggested as a possible way to get this behavior. After inspection of lisp/server.el and trying a few test cases I found that the server-window variable is not inspected until after frames are created, thus the best I could do with server-window is destroy the newly created frame which would be clunky IMHO. Additionally, lisp/server.el is now lexically scoped (it wasn't in Emacs 23) so server-window can't access tty-name to check if the client is requesting a window system frame or a tty frame. The variable is also not inspected when a file argument is not provided. But I digress. As an example: $ Emacs.app/Contents/MacOS/Emacs -Q --daemon $ Emacs.app/Contents/MacOS/bin/emacsclient -c -n Insert and evaluate the following in the scratch buffer: (setq server-window (lambda (next-buffer) (message "SERVER-WINDOW"))) $ Emacs.app/Contents/MacOS/bin/emacsclient -c -n ~/a.txt Prints the following in *Messages*: When done with this frame, type C-x 5 0 SERVER-WINDOW That demonstrates that the frame is created before server-window is called. So server-window can't be made to provide the desired behavior. It is possible to use emacsclient's --eval option to provide this behavior, but it is extremely ugly. Plus it occurred to me that this behavior may be general enough to include in emacsclient as a standard option and would be much cleaner. I'm proposing adding a -C option to emacsclient that would "create a new frame if one doesn't exist otherwise use the current Emacs frame." I'd be happy to make the required changes and submit a patch. Thanks, Eddie In GNU Emacs 24.0.94.1 (x86_64-apple-darwin11.3.0, NS apple-appkit-1138.32) of 2012-03-16 on lore.local Windowing system distributor `Apple', version 10.3.1138 Configured using: `configure '--with-ns''