]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/progmodes/grep.el (grep-process-setup): Use `buffer-modified-p'
authorJuri Linkov <juri@jurta.org>
Mon, 22 Aug 2011 09:54:38 +0000 (12:54 +0300)
committerJuri Linkov <juri@jurta.org>
Mon, 22 Aug 2011 09:54:38 +0000 (12:54 +0300)
to check for empty output.

Fixes: debbugs:9226
lisp/ChangeLog
lisp/progmodes/grep.el

index e8a6cd738266a0d090678e51ff26a175c6430160..bfcbaa27b6f2695e1f0380d5a7b1c38ebe9c437e 100644 (file)
@@ -1,3 +1,8 @@
+2011-08-22  Juri Linkov  <juri@jurta.org>
+
+       * progmodes/grep.el (grep-process-setup): Use `buffer-modified-p'
+       to check for empty output (bug#9226).
+
 2011-08-22  Chong Yidong  <cyd@stupidchicken.com>
 
        * progmodes/scheme.el (scheme-mode-syntax-table): Don't use
index 31100f3fac2f4db06ced43388fe23d47e7f57afc..709f01444bf4f2c2cac4e7ca90eff90c44be7774 100644 (file)
@@ -463,9 +463,12 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'."
   (set (make-local-variable 'compilation-exit-message-function)
        (lambda (status code msg)
         (if (eq status 'exit)
-            (cond ((zerop code)
+            ;; This relies on the fact that `compilation-start'
+            ;; sets buffer-modified to nil before running the command,
+            ;; so the buffer is still unmodified if there is no output.
+            (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)))