]> git.eshelyaron.com Git - emacs.git/commitdiff
(diff): Set compilation-exit-message-function.
authorKarl Heuer <kwzh@gnu.org>
Tue, 9 Jan 1996 23:14:47 +0000 (23:14 +0000)
committerKarl Heuer <kwzh@gnu.org>
Tue, 9 Jan 1996 23:14:47 +0000 (23:14 +0000)
lisp/diff.el

index eb2e41528962a382ae6d3892dee978c0b0dbecc7..2d681b8af27b07a95e680ecb4f2d4f7ba4d99b56 100644 (file)
@@ -220,6 +220,19 @@ With prefix arg, prompt for diff switches."
                                  "No more differences" "Diff"
                                  'diff-parse-differences))
          (pop-to-buffer buf)
+         ;; Avoid frightening people with "abnormally terminated"
+         ;; if diff finds differences.
+         (set (make-local-variable 'compilation-exit-message-function)
+              (lambda (proc msg)
+                (let ((code (process-exit-status proc)))
+                  (if (eq (process-status proc) 'exit)
+                      (cond ((zerop code)
+                             '("finished (no differences)\n" . "finished"))
+                            ((= code 1)
+                             '("finished\n" . "finished"))
+                            (t
+                             (cons msg code)))
+                    (cons msg code)))))
          (set (make-local-variable 'diff-old-file) old)
          (set (make-local-variable 'diff-new-file) new)
          (set (make-local-variable 'diff-old-temp-file) old-alt)