From: "Drew Adams" <drew.adams@oracle.com>
Subject: problem using call-process with grep
Date: Thu, 22 Dec 2005 22:45:30 -0800 [thread overview]
Message-ID: <DNEMKBNJBGPAOPIJOOICAEKPDAAA.drew.adams@oracle.com> (raw)
In-Reply-To: <MEEKKIABFKKDFJMPIOEBOEBLCOAA.drew.adams@oracle.com>
I hesitate whether to send this to emacs-devel or help-gnu-emacs. I doubt
that this is a bug - it's probably user ignorance, because I see the same
behavior in both Emacs 20 and 22. Perhaps someone can tell me what the
problem is.
Type this in a file foo, ending the file with a newline:
alpha,beta,gamma,delta,epsilon
Evaluate this:
(call-process "grep" nil
(generate-new-buffer "Result")
nil "epsilon$" "foo")
As expected, buffer Result contains the same text as file foo. The
evaluation returns 0.
Change the regexp passed to `grep' to this: "epsilon\\($\\)" and try again.
I expect the same result, but, instead, buffer Result is empty and the
evaluation returns 1.
If I run the Emacs `grep' command like this (with or without the options),
it works:
grep -nH -e "epsilon\\($\\)" foo
This gives the same result using Emacs `grep' (single backslashes):
grep "epsilon\($\)" foo
(Since these are not Lisp strings, but input args to the Emacs `grep'
command, which it passes on to the `grep' process, I'm a bit surprised to
see that the double-backslash version works, but it does.)
I'm using Cygwin `grep' (GNU `grep'), for which the doc says that \(, $, and
\) are supported in the usual way. And if I run grep from the Cygwin command
line (with either parenthetical regexp - single or double backslashes), it
works OK. I only have the problem when I use `call-process'.
I'm sure I'm missing something simple (doing something wrong in the call to
`call-process') - I'd be grateful for the explanation.
FWIW: The coding system for the file foo is undecided-unix. The defaults for
subprocess I/O are undecided-dos (decoding) and undecided-unix (encoding).
I've loaded cywin-mount.el, version 1.2.1 - 2001-05-13. shell-file-name is
"bash". w32-quote-process-arg is ?\". process-coding-system-alist is
(("bash" raw-text-dos . raw-text-unix)).
In GNU Emacs 22.0.50.1 (i386-mingw-nt5.1.2600)
of 2005-06-26 on NONIQPC
X server distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc
(3.3) --cflags -I../../jpeg-6b-3/include -I../../libpng-1.2.8/include -I../.
./tiff-3.6.1-2/include -I../../xpm-nox-4.2.0/include -I../../zlib-1.2.2/incl
ude'
Thanks.
next parent reply other threads:[~2005-12-23 6:45 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <MEEKKIABFKKDFJMPIOEBOEBLCOAA.drew.adams@oracle.com>
2005-12-23 6:45 ` Drew Adams [this message]
2005-12-23 18:11 ` problem using call-process with grep 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
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DNEMKBNJBGPAOPIJOOICAEKPDAAA.drew.adams@oracle.com \
--to=drew.adams@oracle.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).