emacs-devel
[Top][All Lists]
Advanced

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

RE: problem using call-process with grep


From: Drew Adams
Subject: RE: problem using call-process with grep
Date: Fri, 23 Dec 2005 15:16:44 -0800

    >  (call-process "grep" nil
    >                (generate-new-buffer "Result")
    >                nil "epsilon\\($\\)" "foo")
    >
    > This does *not* work for me.

    I guess you want to call some echo-like program compiled in the same
    way as your "grep" to see what actually is happening here.  Probably
    some part of Cygwin's Unix emulation layer is trying variable
    substitution or replacing backward with forward slashes or adding
    quotes or something like that.

Could you be more specific on what to try?

I also don't understand how this could be a Cygwin problem if there is no
problem when I call `grep' directly in a Cygwin shell (bash) or indirectly
via the Emacs `grep' command. That is, once bash gets the `grep' arguments
correctly, it does the right thing. It is `call-process' that in effect
passes the args to `grep'.

I don't claim that this is not a Cygwin (bash) problem; I just don't
understand how it could be. To me, this is a problem with `call-process'. My
assumption was that I was simply not calling `call-process' correctly (I'm
not claiming there is a bug with `call-process').

But you made me think of another possibility. Could it be that
`call-process' somehow processes its arguments in such a way that it applies
Windows-to-Unix directory-separator conversion to all of them, flipping
backslashes to slashes?

I don't think so. For instance, if I use this regexp, it works OK:
"eps\\ilon$". If backslashes were changed to slashes, then this would not
match "epsilon" in the file.

Another regexp that doesn't work: "gamma\\(,\\)" - just to show that the
problem is with \(...\), not with $ (variable substitution).





reply via email to

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