to check for empty output.
Fixes: debbugs:9226
+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
(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)))