all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Giorgos Keramidas <keramida@ceid.upatras.gr>
Cc: emacs-devel@gnu.org
Subject: Re: problem using call-process with grep
Date: Sat, 24 Dec 2005 06:48:09 +0200	[thread overview]
Message-ID: <20051224044809.GA5095@flame.pc> (raw)
In-Reply-To: <DNEMKBNJBGPAOPIJOOICEELHDAAA.drew.adams@oracle.com>

        >     maybe what arrives at the application level is gamma(,)
        >     without backslashes
        >
        > Bingo!  Thank you, David.
        >
        > Don't know why I didn't see this before. I just need to use
        > "\\\\" to get \, as is usual with a Lisp string (which this
        > is). Sorry for wasting time.

        Uh, there is still something wrong here.  You wrote:

        >     >  (call-process "grep" nil
        >     >                (generate-new-buffer "Result")
        >     >                nil "epsilon\\($\\)" "foo")
        >     >

        This means that the string is 'epsilon\($\)', and call-process
        is supposed to pass this unmolested into grep.  So some other
        entity is removing a level of backslashes that shouldn't.  It is
        either call-process, or grep itself.

    Hm, you're right. It's as if we had to supply a regexp that would match the
    literal string `\('. The Lisp string to do that would be "\\\\(". I just
    re-read the doc for `grep' and `call-process'; neither mentions anything
    about this.

    To figure out whether this is specific to Cygwin `grep' or a property of
    `call-process', could someone else (e.g. on GNU/Linux) please try these:

    (call-process "/path/to/your/echo" nil t nil  "foo\\\\(bar\\\\)")

Using M-: the following expression evaluates to:

    (call-process "/bin/echo" nil t nil  "foo\\\\(bar\\\\)")
    => 0 (#o0, #x0)

In my Lisp interaction buffer the following is inserted:

    foo\\(bar\\)

Evaluating the following expression:

    (call-process "/path/to/your/echo" nil t nil  "foo\\(bar\\)")
    => 0 (#o0, #x0)

Results in the following line of text:

    foo\(bar\)

This is not GNU/Linux but FreeBSD/amd64, FWIW.  The results seem
to indicate that there is only one level of escaping here, the
one done by Lisp.

  reply	other threads:[~2005-12-24  4:48 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-22 18:05 Q on call-process and grep Drew Adams
2005-12-23  6:45 ` problem using call-process with grep Drew Adams
2005-12-23 18:11   ` Richard M. Stallman
2005-12-23 18:24     ` Drew Adams
2005-12-23 22:02       ` Kevin Rodgers
2005-12-23 22:18         ` Drew Adams
2005-12-23 22:42           ` David Kastrup
2005-12-23 23:16             ` Drew Adams
2005-12-23 23:20               ` David Kastrup
2005-12-23 23:44                 ` Drew Adams
2005-12-23 23:52                   ` David Kastrup
2005-12-24  0:42                     ` Drew Adams
2005-12-24  4:48                       ` Giorgos Keramidas [this message]
2005-12-24 16:32       ` Richard M. Stallman
2005-12-24 16:35         ` Drew Adams
2005-12-24 16:57           ` Eli Zaretskii
2005-12-24 17:08             ` Drew Adams
2005-12-24 17:35               ` Eli Zaretskii
     [not found] <jku0cz1e9l.fsf@glug.org>
2005-12-24  1:51 ` Drew Adams
2005-12-24 11:56   ` Eli Zaretskii
2005-12-24 15:48     ` Drew Adams
2005-12-24 16:36       ` Eli Zaretskii
2005-12-24 16:39         ` Drew Adams

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=20051224044809.GA5095@flame.pc \
    --to=keramida@ceid.upatras.gr \
    --cc=emacs-devel@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.