From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#9226: 23.3; [rgrep]; (matches found) ? Date: Wed, 17 Aug 2011 19:50:00 +0300 Organization: JURTA Message-ID: <87y5yskmku.fsf@mail.jurta.org> References: <87pqkdwblb.fsf@mail.jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1313600362 1950 80.91.229.12 (17 Aug 2011 16:59:22 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 17 Aug 2011 16:59:22 +0000 (UTC) Cc: 9226@debbugs.gnu.org To: Dave Abrahams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 17 18:59:16 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QtjST-0001Ff-Pt for geb-bug-gnu-emacs@m.gmane.org; Wed, 17 Aug 2011 18:59:13 +0200 Original-Received: from localhost ([::1]:48246 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QtjST-0002bi-3n for geb-bug-gnu-emacs@m.gmane.org; Wed, 17 Aug 2011 12:59:13 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:44352) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QtjSQ-0002bG-2Z for bug-gnu-emacs@gnu.org; Wed, 17 Aug 2011 12:59:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QtjSP-0002Rv-2H for bug-gnu-emacs@gnu.org; Wed, 17 Aug 2011 12:59:10 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:35043) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QtjSP-0002Rr-0o for bug-gnu-emacs@gnu.org; Wed, 17 Aug 2011 12:59:09 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QtjUE-000838-Fx; Wed, 17 Aug 2011 13:01:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 17 Aug 2011 17:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9226 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 9226-submit@debbugs.gnu.org id=B9226.131360043430908 (code B ref 9226); Wed, 17 Aug 2011 17:01:02 +0000 Original-Received: (at 9226) by debbugs.gnu.org; 17 Aug 2011 17:00:34 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QtjTk-00082S-Vb for submit@debbugs.gnu.org; Wed, 17 Aug 2011 13:00:33 -0400 Original-Received: from smarty.dreamhost.com ([208.113.175.8]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QtjTi-00082H-1P for 9226@debbugs.gnu.org; Wed, 17 Aug 2011 13:00:31 -0400 Original-Received: from ps18281.dreamhostps.com (ps18281.dreamhost.com [69.163.218.105]) by smarty.dreamhost.com (Postfix) with ESMTP id BC7C36E8065; Wed, 17 Aug 2011 09:58:34 -0700 (PDT) Original-Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 9A463451C281; Wed, 17 Aug 2011 09:58:32 -0700 (PDT) In-Reply-To: (Dave Abrahams's message of "Wed, 17 Aug 2011 10:52:44 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Wed, 17 Aug 2011 13:01:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:50110 Archived-At: > 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)))