X-Git-Url: https://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fspam-stat.el;h=dcebb7086d59de8201b0e35211f15359fa3e5511;hb=9a60f093f45ad3169be0d0cc4a2bf75ba599aca8;hp=66d4ff3f38303fd2bb02a20564f4c4847763362d;hpb=ef5b0c867df19dd61b49f58574d18bb4221442a4;p=gnus diff --git a/lisp/spam-stat.el b/lisp/spam-stat.el index 66d4ff3f3..dcebb7086 100644 --- a/lisp/spam-stat.el +++ b/lisp/spam-stat.el @@ -238,12 +238,6 @@ This uses `gnus-article-buffer'." (set-buffer gnus-original-article-buffer) (spam-stat-store-current-buffer))) -(when spam-stat-install-hooks - (add-hook 'nnmail-prepare-incoming-message-hook - 'spam-stat-store-current-buffer) - (add-hook 'gnus-select-article-hook - 'spam-stat-store-gnus-article-buffer)) - ;; Data -- not using defstruct in order to save space and time (defvar spam-stat (make-hash-table :test 'equal) @@ -542,7 +536,7 @@ You can use this to determine error rates." (dolist (f files) (when (and (file-readable-p f) (file-regular-p f) - (> (nth 7 (file-attributes f)))) + (> (nth 7 (file-attributes f)) 0)) (setq count (1+ count)) (message "Reading %.2f%%, score %.2f%%" (/ count max) (/ score count)) @@ -567,6 +561,25 @@ COUNT defaults to 5" (remhash key spam-stat))) spam-stat)) +(defun spam-stat-install-hooks-function () + "Install the spam-stat function hooks" + (interactive) + (add-hook 'nnmail-prepare-incoming-message-hook + 'spam-stat-store-current-buffer) + (add-hook 'gnus-select-article-hook + 'spam-stat-store-gnus-article-buffer)) + +(when spam-stat-install-hooks + (spam-stat-install-hooks-function)) + +(defun spam-stat-unload-hook () + "Uninstall the spam-stat function hooks" + (interactive) + (remove-hook 'nnmail-prepare-incoming-message-hook + 'spam-stat-store-current-buffer) + (remove-hook 'gnus-select-article-hook + 'spam-stat-store-gnus-article-buffer)) + (provide 'spam-stat) ;;; spam-stat.el ends here