From: Juri Linkov <juri@jurta.org>
To: Dave Abrahams <dave@boostpro.com>
Cc: 9226@debbugs.gnu.org
Subject: bug#9226: 23.3; [rgrep]; (matches found) ?
Date: Wed, 17 Aug 2011 19:50:00 +0300 [thread overview]
Message-ID: <87y5yskmku.fsf@mail.jurta.org> (raw)
In-Reply-To: <m2ippwjdj7.fsf@140-182-243-147.dhcp-bl.indiana.edu> (Dave Abrahams's message of "Wed, 17 Aug 2011 10:52:44 -0400")
> Sounds like an improvement to me.
This patch below fixes the case you reported and also the case of
"find | xargs grep" because it checks the value of buffer-modified
set in `compilation-start', whereas empty output doesn't change it.
It still relies on unreliable heuristics, but I carefully tested it with
all known test cases and it displays correct messages in all of them.
Running grep on the dir with a file containing "test", I get the following
results (command and exit status message):
grep -inH -e "test" *
Grep finished (matches found)
grep -inH -e "testx" *
Grep finished with no matches found
grepx -inH -e "test" *
Grep exited abnormally with code 127
find . -exec grep -i test {} \;
Grep finished (matches found)
find . -exec grep -i testx {} \;
Grep finished with no matches found
find . -name testx -exec grep -i testx {} \;
Grep finished with no matches found
find . -print0 | xargs -0 -e grep -i -nH -e test
Grep finished (matches found)
find . -print0 | xargs -0 -e grep -i -nH -e testx
Grep finished with no matches found
=== modified file 'lisp/progmodes/grep.el'
--- lisp/progmodes/grep.el 2011-08-10 20:31:17 +0000
+++ lisp/progmodes/grep.el 2011-08-17 16:47:24 +0000
@@ -463,9 +463,9 @@ (defun grep-process-setup ()
(set (make-local-variable 'compilation-exit-message-function)
(lambda (status code msg)
(if (eq status 'exit)
- (cond ((zerop code)
+ (cond ((and (zerop code) (buffer-modified-p))
'("finished (matches found)\n" . "matched"))
- ((= code 1)
+ ((or (= code 1) (not (buffer-modified-p)))
'("finished with no matches found\n" . "no match"))
(t
(cons msg code)))
next prev parent reply other threads:[~2011-08-17 16:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-03 1:40 bug#9226: 23.3; [rgrep]; (matches found) ? Dave Abrahams
2011-08-10 7:16 ` Glenn Morris
2011-08-10 13:35 ` Stefan Monnier
2011-08-10 15:10 ` Juri Linkov
2011-08-17 14:52 ` Dave Abrahams
2011-08-17 15:02 ` Lennart Borgman
2011-08-17 16:50 ` Juri Linkov [this message]
2011-08-22 9:54 ` Juri Linkov
2011-09-17 18:24 ` Juri Linkov
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=87y5yskmku.fsf@mail.jurta.org \
--to=juri@jurta.org \
--cc=9226@debbugs.gnu.org \
--cc=dave@boostpro.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).