Synch to Gnus 200311252305.
authoryamaoka <yamaoka>
Tue, 25 Nov 2003 23:40:54 +0000 (23:40 +0000)
committeryamaoka <yamaoka>
Tue, 25 Nov 2003 23:40:54 +0000 (23:40 +0000)
lisp/ChangeLog
lisp/spam.el

index 83709c3..392c1cf 100644 (file)
@@ -47,6 +47,9 @@
        bogofilter, spamoracle): rewrite registration/unregistration
        functions to take a list of articles and the unregister option.
        Much hilarity ensues.
+       (spam-initialize): spam-stat-maybe-{save,load} already respect spam-use-stat
+       (spam-stat-register-ham-routine, spam-stat-register-spam-routine):
+       don't load and save unnecessarily
 
        * spam-stat.el (spam-stat-dirty): new variable, set when the stats
        database is modified
index c644d4b..85273b5 100644 (file)
@@ -1292,29 +1292,25 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)."
          (spam-stat-split-fancy)))
 
       (defun spam-stat-register-spam-routine (articles &optional unregister)
-       (spam-stat-load)        
        (dolist (article articles)
          (let ((article-string (spam-get-article-as-string article)))
            (with-temp-buffer
              (insert article-string)
              (if unregister
                  (spam-stat-buffer-change-to-non-spam)
-             (spam-stat-buffer-is-spam)))))
-       (spam-stat-save))
+             (spam-stat-buffer-is-spam))))))
 
       (defun spam-stat-unregister-spam-routine (articles)
        (spam-stat-register-spam-routine articles t))
 
       (defun spam-stat-register-ham-routine (articles &optional unregister)
-       (spam-stat-load)        
        (dolist (article articles)
          (let ((article-string (spam-get-article-as-string article)))
            (with-temp-buffer
              (insert article-string)
              (if unregister
                  (spam-stat-buffer-change-to-spam)
-             (spam-stat-buffer-is-non-spam)))))
-       (spam-stat-save))
+             (spam-stat-buffer-is-non-spam))))))
 
       (defun spam-stat-unregister-ham-routine (articles)
        (spam-stat-register-ham-routine articles t))
@@ -1326,6 +1322,8 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)."
        (when spam-use-stat (spam-stat-save))))
 
   (file-error (progn
+               (defalias 'spam-stat-load 'ignore)
+               (defalias 'spam-stat-save 'ignore)
                (defalias 'spam-maybe-spam-stat-load 'ignore)
                (defalias 'spam-maybe-spam-stat-save 'ignore)
                (defalias 'spam-stat-register-ham-routine 'ignore)
@@ -1337,8 +1335,6 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)."
                (defalias 'spam-stat-buffer-is-non-spam 'ignore)
                (defalias 'spam-stat-buffer-change-to-non-spam 'ignore)
                (defalias 'spam-stat-split-fancy 'ignore)
-               (defalias 'spam-stat-load 'ignore)
-               (defalias 'spam-stat-save 'ignore)
                (defalias 'spam-check-stat 'ignore))))
 
 \f
@@ -1653,10 +1649,9 @@ REMOVE not nil, remove the ADDRESSES."
   (push '((eq mark gnus-spam-mark) . spam-face)
        gnus-summary-highlight)
   ;; Add hooks for loading and saving the spam stats
-  (when spam-use-stat
-    (add-hook 'gnus-save-newsrc-hook 'spam-maybe-spam-stat-save)
-    (add-hook 'gnus-get-top-new-news-hook 'spam-maybe-spam-stat-load)
-    (add-hook 'gnus-startup-hook 'spam-maybe-spam-stat-load))
+  (add-hook 'gnus-save-newsrc-hook 'spam-maybe-spam-stat-save)
+  (add-hook 'gnus-get-top-new-news-hook 'spam-maybe-spam-stat-load)
+  (add-hook 'gnus-startup-hook 'spam-maybe-spam-stat-load)
   (add-hook 'gnus-summary-prepare-exit-hook 'spam-summary-prepare-exit)
   (add-hook 'gnus-summary-prepare-hook 'spam-summary-prepare)
   (add-hook 'gnus-get-new-news-hook 'spam-setup-widening))