From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thorsten Jolitz Newsgroups: gmane.emacs.help Subject: Re: Emacsclient sends ^J, PicoLisp receives _ Date: Wed, 26 Feb 2014 16:54:26 +0100 Message-ID: <871typx425.fsf@gmail.com> References: <87wqgiw5bw.fsf@gmail.com> <87mwhew394.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1393430053 7282 80.91.229.3 (26 Feb 2014 15:54:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 26 Feb 2014 15:54:13 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Feb 26 16:54:17 2014 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 1WIgoK-00026L-5N for geh-help-gnu-emacs@m.gmane.org; Wed, 26 Feb 2014 16:54:16 +0100 Original-Received: from localhost ([::1]:41415 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WIgoJ-00018W-Ov for geh-help-gnu-emacs@m.gmane.org; Wed, 26 Feb 2014 10:54:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58188) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WIgo0-00017R-02 for help-gnu-emacs@gnu.org; Wed, 26 Feb 2014 10:54:03 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WIgns-0001By-8L for help-gnu-emacs@gnu.org; Wed, 26 Feb 2014 10:53:55 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:58541) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WIgns-0001Bt-25 for help-gnu-emacs@gnu.org; Wed, 26 Feb 2014 10:53:48 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WIgnp-00009U-Sz for help-gnu-emacs@gnu.org; Wed, 26 Feb 2014 16:53:45 +0100 Original-Received: from e178059018.adsl.alicedsl.de ([85.178.59.18]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 26 Feb 2014 16:53:45 +0100 Original-Received: from tjolitz by e178059018.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 26 Feb 2014 16:53:45 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 72 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: e178059018.adsl.alicedsl.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:8T4Os9gvaxY6cU3qH5kqTDd/g88= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:96209 Archived-At: Thorsten Jolitz writes: Again following up to myself, I detected another possible culprit for the 'bad' underscore introduced when sending output from Emacsclient to PicoLisp: In emacsclient.c I found this function: #+begin_src C /* In STR, insert a & before each &, each space, each newline, and any initial -. Change spaces to underscores, too, so that the return value never contains a space. Does not change the string. Outputs the result to S. */ static void quote_argument (HSOCKET s, const char *str) { char *copy = (char *) xmalloc (strlen (str) * 2 + 1); const char *p; char *q; p = str; q = copy; while (*p) { if (*p == ' ') { ,*q++ = '&'; ,*q++ = '_'; p++; } [...] #+end_src that is called (together with its antipode `unquote_argument') quite a few times: ,---------------------------------------------------------------------------- | 17 matches for "quote_argument" in buffer: emacsclient.c | 782:quote_argument (HSOCKET s, const char *str) | 819:/* The inverse of quote_argument. Removes quoting in string STR by | 823:unquote_argument (char *str) | 1599: quote_argument (emacs_socket, environ[i]); | 1604: quote_argument (emacs_socket, cwd); | 1618: quote_argument (emacs_socket, display); | 1625: quote_argument (emacs_socket, parent_id); | 1632: quote_argument (emacs_socket, frame_parameters); | 1649: quote_argument (emacs_socket, tty_name); | 1651: quote_argument (emacs_socket, tty_type); | 1669: quote_argument (emacs_socket, argv[i]); | 1681: quote_argument (emacs_socket, argv[i]); | 1708: quote_argument (emacs_socket, argv[i]); | 1718: quote_argument (emacs_socket, str); | 1786: str = unquote_argument (p + strlen ("-print ")); | 1796: str = unquote_argument (p + strlen ("-print-nonl ")); | 1803: str = unquote_argument (p + strlen ("-error ")); `---------------------------------------------------------------------------- Now I'm not that much of a C programmer, so I'm not sure what is actually quoted and unquoted. Is it possible that Emacsclients quotes and unquotes the output string produced by my Org-exporter when sending it to PicoLisp (replacing spaces with underscores and vice-versa) and occasionally things go wrong in the process (i.e. some underscores are left in the final string arriving at the PicoLisp side)? Or is this quoting/unquoting done by Emacsclient completely unrelated to my issue? -- cheers, Thorsten