all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Problem quoting expression to be eval'ed by emacsclient
Date: Fri, 25 Oct 2013 16:47:03 +0300	[thread overview]
Message-ID: <83k3h1h38o.fsf@gnu.org> (raw)
In-Reply-To: <86mwlxplvb.fsf@somewhere.org>

> From: "Sebastien Vauban" <sva-news@mygooglest.com>
> Date: Fri, 25 Oct 2013 14:37:28 +0200
> 
> >> The above tests I made are from a Cygwin Zsh session.
> >
> > And emacsclient was a Cygwin build or a native build? If the latter, your
> > problems could be due to this mix. (Your example works for me from cmd and
> > even from MSYS Bash.)
> 
> That does indeed makes a difference:
> 
> --8<---------------cut here---------------start------------->8---
> $ emacsclient -e "(message \"hello\")"
> 
> *ERROR*: End of file during parsing
> --8<---------------cut here---------------end--------------->8---
> 
> --8<---------------cut here---------------start------------->8---
> $ /usr/bin/emacsclient -e "(message \"hello\")"
> /usr/bin/emacsclient: can't find socket; have you started the server?
> To start the server in Emacs, type "M-x server-start".
> "hello"
> --8<---------------cut here---------------end--------------->8---

I'm confused: didn't you say that /usr/bin is a Cygwin directory?  If
so, /usr/bin/emacsclient is a Cygwin build of emacsclient, right?
Then what kind of emacsclient is in ~/bin?

> However, that still leaves me with the following problem:
> 
>   How can I work in a correct shell on Windows (read: not `cmd.exe'), and
>   edit in my graphical Emacs w32?

My best advice is to avoid that combination entirely.  It's just too
fragile and replete of subtle "issues".

Let me turn the table and ask why do you need to invoke emacsclient
from the shell command line?  Why not simply visit the file from the
running Emacs?  (You do have an Emacs session running at all times,
right?)  emacsclient is mainly for letting other programs ask Emacs to
edit a file.  Since the w32 Emacs does not support multiple tty
devices in the same session, even invoking "emacsclient -t" bu hand
doesn't make sense when the server is the w32 Emacs.  So I wonder why
do you use this at all.

Another pertinent question is: why not use the Cygwin build of Emacs?
It does support GUI sessions, and can even be built with the w32
graphics as its "toolkit".  If you use a Cygwin Emacs and emacsclient
from the Cygwin shell, I don't expect you to have any problems with
quoting.

But if, for some reason, you must use this crazy mix, then I suggest
to at least switch to the MSYS Bash.  It is friendlier to native
programs than Cygwin shells, although you will have problems there as
well.

> - an Emacs server must be contacted by an `emacsclient' of the same release

This is not really accurate.  It's just that the format of the server
file changed between Emacs 23 and 24, so you cannot mix client and
server that are on different sides of that schism.

> - Cygwin (/usr/bin) is second in my PATH, after ~/bin

Why do you need Cygwin executables on your PATH?

And what kind of programs are in ~/bin?

> I currently have a small `~/bin/emacsclient' script (one-liner) which allows me
> to set the full path to the right `emacsclient' without having to fiddle with
> the PATH environment variable (as that requires me to quit my shell, and start
> a new one):
> 
> --8<---------------cut here---------------start------------->8---
> "C:/Program Files (x86)/emacs-trunk/bin/emacsclient" $@
> --8<---------------cut here---------------end--------------->8---
> 
> This is a hack.

I don't see anything wrong with such a script.  But it only works
around the PATH problem, it does nothing to alleviate the subtle
incompatibilities between native Windows executables and Cygwin/MSYS
executables.

> Indeed, I'd like to be able to launch whichever Emacs version
> (clicking on one of the many versions I have on my Windows desktop), and that
> launching `emacsclient' in the shell would work in all contexts.

See above: I don't understand why you are invoking emacsclient in the
first place.

As for the v23 vs v24 emacsclient issue, you could have emacsclient23
and emacsclient24 (scripts, aliases, whatever) to DTRT for each one.



  reply	other threads:[~2013-10-25 13:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-23  8:33 Problem quoting expression to be eval'ed by emacsclient Sebastien Vauban
2013-10-23  8:52 ` Thorsten Jolitz
2013-10-23 14:07   ` Tassilo Horn
2013-10-23 15:33   ` Eli Zaretskii
     [not found]   ` <mailman.4544.1382542407.10748.help-gnu-emacs@gnu.org>
2013-10-23 21:56     ` Sebastien Vauban
2013-10-24  2:52       ` Eli Zaretskii
     [not found]       ` <mailman.4580.1382583151.10748.help-gnu-emacs@gnu.org>
2013-10-25 12:37         ` Sebastien Vauban
2013-10-25 13:47           ` Eli Zaretskii [this message]
     [not found]           ` <mailman.4697.1382708854.10748.help-gnu-emacs@gnu.org>
2013-10-30  9:59             ` Sebastien Vauban
2013-10-30 11:38               ` Stefan Monnier
2013-10-30 18:55               ` Eli Zaretskii
     [not found]               ` <mailman.4965.1383133220.10748.help-gnu-emacs@gnu.org>
2013-11-07 15:37                 ` Sebastien Vauban
     [not found]               ` <mailman.4986.1383159329.10748.help-gnu-emacs@gnu.org>
2013-11-07 15:44                 ` Sebastien Vauban
2013-10-23 10:14 ` Andreas Röhler

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=83k3h1h38o.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=help-gnu-emacs@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.