help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacsclient sends ^J, PicoLisp receives _


From: Thorsten Jolitz
Subject: Re: Emacsclient sends ^J, PicoLisp receives _
Date: Wed, 26 Feb 2014 16:54:26 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Thorsten Jolitz <tjolitz@gmail.com> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]