From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: Problem quoting expression to be eval'ed by emacsclient Date: Fri, 25 Oct 2013 16:47:03 +0300 Message-ID: <83k3h1h38o.fsf@gnu.org> References: <86y55kcrpc.fsf@somewhere.org> <87a9i02wu4.fsf@gmail.com> <86wql3tzwf.fsf@somewhere.org> <86mwlxplvb.fsf@somewhere.org> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1382708861 4965 80.91.229.3 (25 Oct 2013 13:47:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 25 Oct 2013 13:47:41 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 25 15:47:44 2013 Return-path: Envelope-to: geh-help-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 1VZhjq-0003H1-Vw for geh-help-gnu-emacs@m.gmane.org; Fri, 25 Oct 2013 15:47:43 +0200 Original-Received: from localhost ([::1]:59410 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZhjq-0006TS-Kg for geh-help-gnu-emacs@m.gmane.org; Fri, 25 Oct 2013 09:47:42 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35615) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZhja-0006SM-PG for help-gnu-emacs@gnu.org; Fri, 25 Oct 2013 09:47:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VZhjO-00049r-QD for help-gnu-emacs@gnu.org; Fri, 25 Oct 2013 09:47:26 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:64479) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZhjO-00049f-IB for help-gnu-emacs@gnu.org; Fri, 25 Oct 2013 09:47:14 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0MV800M008ULFN00@a-mtaout20.012.net.il> for help-gnu-emacs@gnu.org; Fri, 25 Oct 2013 16:47:13 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MV800M1R8YODX40@a-mtaout20.012.net.il> for help-gnu-emacs@gnu.org; Fri, 25 Oct 2013 16:47:13 +0300 (IDT) In-reply-to: <86mwlxplvb.fsf@somewhere.org> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.166 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:94212 Archived-At: > From: "Sebastien Vauban" > 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.