all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jason Lewis <jason@dickson.st>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 8783@debbugs.gnu.org
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	[thread overview]
Message-ID: <4DEC2554.9010702@dickson.st> (raw)
In-Reply-To: <E1QS4Ai-0007hg-5K@fencepost.gnu.org> (sfid-20110602_192642_778095_1920F8FA)

Eli Zaretskii wrote:
>> Date: Thu, 02 Jun 2011 14:35:47 +1000
>> From: Jason Lewis <jason@dickson.st>
>>
>> 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















  reply	other threads:[~2011-06-06  0:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-02  4:35 bug#8783: 24.0.50; emacsclientw.exe behaviour in win32 not the same as in linux Jason Lewis
2011-06-02  9:26 ` Eli Zaretskii
2011-06-06  0:54   ` Jason Lewis [this message]
2011-06-06  1:48   ` Jason Rumney
2011-07-02 15:17     ` Jason Rumney

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

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

  git send-email \
    --in-reply-to=4DEC2554.9010702@dickson.st \
    --to=jason@dickson.st \
    --cc=8783@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.