added patch from Katsumi Yamaoka to replace display-message-or-buffer
authorTeodor Zlatanov <tzz@lifelogs.com>
Fri, 18 Oct 2002 02:18:43 +0000 (02:18 +0000)
committerTeodor Zlatanov <tzz@lifelogs.com>
Fri, 18 Oct 2002 02:18:43 +0000 (02:18 +0000)
lisp/spam.el

index e6a54f8..ad8daac 100644 (file)
@@ -342,6 +342,20 @@ The regular expression is matched against the address.")
        (setq found t
              cache nil)))
     found))
+
+(defun spam-display-buffer-contents ()
+  "Display contents of the current buffer in the echo area if possible,
+otherwise pop-up the buffer itself."
+  (unless (zerop (buffer-size))
+    (if (<= (count-lines (point-min) (point-max)) 1)
+       (progn
+         (goto-char (point-max))
+         (when (bolp)
+           (backward-char 1))
+         (message "%s" (buffer-substring (point-min) (point))))
+      (goto-char (point-min))
+      (display-buffer (current-buffer)))))
+
 \f
 ;;;; Training via Bogofilter.   Last updated 2002-09-02.
 
@@ -469,9 +483,7 @@ spamicity coefficient of each, and the overall article spamicity."
     (spam-bogofilter-articles nil "-v" (list (gnus-summary-article-number)))
     (save-excursion
       (set-buffer spam-output-buffer-name)
-      (unless (= (point-min) (point-max))
-       (display-message-or-buffer (current-buffer)
-                                  spam-output-buffer-name)))))
+      (spam-display-buffer-contents))))
 
 (defun spam-bogofilter-register-routine ()
   (when (and spam-use-bogofilter spam-bogofilter-path)