From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jason Lewis Newsgroups: gmane.emacs.bugs Subject: bug#8783: 24.0.50; emacsclientw.exe behaviour in win32 not the same as in linux Date: Mon, 06 Jun 2011 10:54:44 +1000 Message-ID: <4DEC2554.9010702@dickson.st> References: <4DE71323.60409@dickson.st> (sfid-20110602_192642_778095_1920F8FA) NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1307321725 23059 80.91.229.12 (6 Jun 2011 00:55:25 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 6 Jun 2011 00:55:25 +0000 (UTC) Cc: 8783@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jun 06 02:55:20 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QTO6C-0004T3-6e for geb-bug-gnu-emacs@m.gmane.org; Mon, 06 Jun 2011 02:55:20 +0200 Original-Received: from localhost ([::1]:39838 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QTO6B-0003nb-3C for geb-bug-gnu-emacs@m.gmane.org; Sun, 05 Jun 2011 20:55:19 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:52766) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QTO5w-0003nU-Mc for bug-gnu-emacs@gnu.org; Sun, 05 Jun 2011 20:55:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QTO5v-00037N-7M for bug-gnu-emacs@gnu.org; Sun, 05 Jun 2011 20:55:04 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53605) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QTO5v-00037J-1V for bug-gnu-emacs@gnu.org; Sun, 05 Jun 2011 20:55:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QTO5u-0004fA-B8; Sun, 05 Jun 2011 20:55:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jason Lewis Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 06 Jun 2011 00:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8783 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 8783-submit@debbugs.gnu.org id=B8783.130732169817913 (code B ref 8783); Mon, 06 Jun 2011 00:55:02 +0000 Original-Received: (at 8783) by debbugs.gnu.org; 6 Jun 2011 00:54:58 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QTO5p-0004er-AM for submit@debbugs.gnu.org; Sun, 05 Jun 2011 20:54:58 -0400 Original-Received: from ipmail06.adl2.internode.on.net ([150.101.137.129]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QTO5m-0004eZ-Sj for 8783@debbugs.gnu.org; Sun, 05 Jun 2011 20:54:56 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApwEAAQl7E07p/21/2dsb2JhbABTpy2Icb5KhiEElUEdimc Original-Received: from ppp167-253-181.static.internode.on.net (HELO debian.organictrader.com.au) ([59.167.253.181]) by ipmail06.adl2.internode.on.net with ESMTP; 06 Jun 2011 10:24:46 +0930 Original-Received: by debian.organictrader.com.au (Postfix, from userid 5001) id 9B56A81659B0; Mon, 6 Jun 2011 10:54:45 +1000 (EST) Original-Received: from [10.0.2.51] (unknown [10.0.2.51]) by debian.organictrader.com.au (Postfix) with ESMTPSA id E7252816EF8C; Mon, 6 Jun 2011 10:54:43 +1000 (EST) User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.23) Gecko/20090812 Lightning/0.9 Thunderbird/2.0.0.23 Mnenhy/0.7.5.0 In-Reply-To: (sfid-20110602_192642_778095_1920F8FA) X-Enigmail-Version: 1.1.1 X-TagToolbar-Keys: D20110606105444828 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sun, 05 Jun 2011 20:55:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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:46983 Archived-At: Eli Zaretskii wrote: >> Date: Thu, 02 Jun 2011 14:35:47 +1000 >> From: Jason Lewis >> >> When I try to launch emacs in win32 using emacsclientw.exe it does not >> seem to work as expected. >> >> on my linux box if I start emacs with either: >> >> emacsclient -c -a "" >> emacsclient -c -a "" somefile.txt >> >> it will start emacs in daemon mode or start a client as necessary > > First, there's no equivalent of emacsclientw.exe on GNU/Linux. You > will be better off comparing with emacsclient on Windows. > > Second, the Windows build does not (yet) support the daemon mode. I > think this explains some of the differences in behavior that you > report. See below. > >> however on windows with the slightly different version: >> >> C:\Users\jason\AppData\Roaming>"c:\Program Files >> (x86)\Emacs\emacs\bin\emacsclientw.exe" -c >> --alternate-editor="c:\Program Files >> (x86)\Emacs\emacs\bin\runemacs.exe" test.txt >> >> it will open a new emacs instance editing text.txt > > Which is as expected, right? (Please tell explicitly which behavior > you think is problematic, because otherwise we need to guess.) > Yes, this is expected >> but then if you run: >> >> C:\Users\jason\AppData\Roaming>"c:\Program Files >> (x86)\Emacs\emacs\bin\emacsclientw.exe" -c >> --alternate-editor="c:\Program Files >> (x86)\Emacs\emacs\bin\runemacs.exe" someotherfile.txt >> >> it fails to open someotherfile.txt in the existing frame (and does not >> create a new frame either) > > AFACT, the -c option is not really supported in the Windows build, > because it generally needs the --display argument which Windows > doesn't support. > I see - that might well be the issue - but what I'm trying to do is find a way to launch emacs, always using the same command, and not have it fail if emacs is not already running, or I do not supply a file to open from the command line. In this example above, I expect it to open someotherfile.txt in a new buffer an emacs frame that is already running - but that seems contrary to the -c option. As far as I can tell, there is no option to open a file in an existing frame? maybe I'm missing something? >> further more, while emacs is already running >> if you run: >> >> C:\Users\jason\AppData\Roaming>"c:\Program Files >> (x86)\Emacs\emacs\bin\emacsclientw.exe" --alternate-editor="c:\Program >> Files (x86)\Emacs\emacs\bin\runemacs.exe" test.txt (no -c option) >> emacs will correctly open the desired file > > As expected, right? > Yes, this is expected. >> however: >> C:\Users\jason\AppData\Roaming>"c:\Program Files >> (x86)\Emacs\emacs\bin\emacsclientw.exe" --alternate-editor="c:\Program >> Files (x86)\Emacs\emacs\bin\runemacs.exe" (no -c option and no >> file name to open) >> >> emacs gives the error: file name or argument required, in a window and >> then aborts and does not either open emacs, nor go to the emacs frame >> if it is already running. > > Expected or not? If not, why not? > I would expect it to open a new frame, or bring an existing frame to the foreground, and display the scratch buffer (as thought I had opened a new instance of emacs) >> This does not seem to be the desired behaviour overall. it makes it >> difficult to make 1 command to either launch emacs or open an existing >> instance of emacs with a new file. > > ??? If you don't use the -c switch, it should behave as you want: > start a new editor if there's no existing one, and otherwise connect > to the existing one. > Ah, maybe that's where I was going wrong? Case 1: no emacs running, no file name given C:\Users\jason\AppData\Roaming>"c:\Program Files (x86)\Emacs\emacs\bin\emacsclientw.exe" --alternate-editor="c:\Program Files (x86)\Emacs\emacs\bin\runemacs.exe" "" Result: launches emacs - desired behaviour Case 2: no emacs running, file name given on command line C:\Users\jason\AppData\Roaming>"c:\Program Files (x86)\Emacs\emacs\bin\emacsclientw.exe" --alternate-editor="c:\Program Files (x86)\Emacs\emacs\bin\runemacs.exe" "somefile.txt" Result: Launches new instance of emacs editing somefile.txt - desired behaviour Case 3: emacs running (but not focused, buffer editing somefile.txt), no file name given on command line C:\Users\jason\AppData\Roaming>"c:\Program Files (x86)\Emacs\emacs\bin\emacsclientw.exe" --alternate-editor="c:\Program Files (x86)\Emacs\emacs\bin\runemacs.exe" "" Result: does nothing - I think this is confusing - I think emacs should become focused and present user with scratch buffer maybe? or at least focus emacs, as clearly I am trying to get an instance of emacs. Case 4: emacs running (but not focused, buffer editing somefile.txt), file name given on command line C:\Users\jason\AppData\Roaming>"c:\Program Files (x86)\Emacs\emacs\bin\emacsclientw.exe" --alternate-editor="c:\Program Files (x86)\Emacs\emacs\bin\runemacs.exe" "someotherfile.txt" Result: opens someotherfile.txt and brings emacs into focus - desired behaviour Just for completeness, I have tested these 4 cases again but with the -c option for create new frame Case 1: no emacs running, no file name given C:\Users\jason\AppData\Roaming>"c:\Program Files (x86)\Emacs\emacs\bin\emacsclientw.exe" -c --alternate-editor="c:\Program Files (x86)\Emacs\emacs\bin\runemacs.exe" "" Result: launches emacs - desired behaviour Case 2: no emacs running, file name given on command line C:\Users\jason\AppData\Roaming>"c:\Program Files (x86)\Emacs\emacs\bin\emacsclientw.exe" -c --alternate-editor="c:\Program Files (x86)\Emacs\emacs\bin\runemacs.exe" "somefile.txt" Result: Launches new instance of emacs editing somefile.txt - desired behaviour Case 3: emacs running (but not focused, buffer editing somefile.txt), no file name given on command line C:\Users\jason\AppData\Roaming>"c:\Program Files (x86)\Emacs\emacs\bin\emacsclientw.exe" -c --alternate-editor="c:\Program Files (x86)\Emacs\emacs\bin\runemacs.exe" "" Result: does nothing - I think this is confusing - I think emacs should become focused and present user with scratch buffer maybe? or at least focus emacs, as clearly I am trying to get an instance of emacs. Case 4: emacs running (but not focused, buffer editing somefile.txt), file name given on command line C:\Users\jason\AppData\Roaming>"c:\Program Files (x86)\Emacs\emacs\bin\emacsclientw.exe" -c --alternate-editor="c:\Program Files (x86)\Emacs\emacs\bin\runemacs.exe" "someotherfile.txt" Result: emacs window flickers for a second, but someotherfile.txt is not opened, and emacs continues to display the somefile.txt buffer. This is not desired behaviour imho. I think it should open someotherfile.txt in the existing frame? or do something useful. User wants file opened - if it is not possible to create another frame, use existing frame? Or at least give an error? In conclusion, it seems as though not using -c is mostly the solution. with the exception of launching emacs without a file name. Jason