From: hmurata Date: Sat, 25 Oct 2003 14:35:44 +0000 (+0000) Subject: * wl-spam.el (wl-spam-save-status): Call elmo-spam-save-status X-Git-Tag: wl-2_11_20~3 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=e868071480bb8fe48096033f37f42ec238ca1f73;p=elisp%2Fwanderlust.git * wl-spam.el (wl-spam-save-status): Call elmo-spam-save-status when new optional argument `force' is non nil or modified. * elsp-spamfilter.el (elsp-spamfilter): Added new slot `modified'. (elmo-spam-modified-p): Defined. (elmo-spam-save-status): Set `modified' slot to nil. (elmo-spam-register-spam-buffer): Set `modified' slot to non nil. (elmo-spam-register-good-buffer): Ditto. * elmo-spam.el (elmo-spam-modified-p): New API. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index c4996f0..d2f5863 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,13 @@ +2003-10-25 Hiroya Murata + + * elsp-spamfilter.el (elsp-spamfilter): Added new slot `modified'. + (elmo-spam-modified-p): Defined. + (elmo-spam-save-status): Set `modified' slot to nil. + (elmo-spam-register-spam-buffer): Set `modified' slot to non nil. + (elmo-spam-register-good-buffer): Ditto. + + * elmo-spam.el (elmo-spam-modified-p): New API. + 2003-10-23 Hiroya Murata * elmo-msgdb.el (elmo-msgdb-get-message-id-from-buffer): Abolish diff --git a/elmo/elmo-spam.el b/elmo/elmo-spam.el index 30f2a13..70294c2 100644 --- a/elmo/elmo-spam.el +++ b/elmo/elmo-spam.el @@ -62,6 +62,9 @@ PROCESSOR is spam processor structure.") "Register contents of BUFFER as non spam. PROCESSOR is spam processor structure.") +(luna-define-generic elmo-spam-modified-p (processor) + "Return non-nil if status of PROCESSOR is modified.") + (luna-define-generic elmo-spam-save-status (processor) "Save status of the PROCESSOR.") diff --git a/elmo/elsp-spamfilter.el b/elmo/elsp-spamfilter.el index e5dcc55..d83a85b 100644 --- a/elmo/elsp-spamfilter.el +++ b/elmo/elsp-spamfilter.el @@ -47,7 +47,7 @@ (eval-and-compile (luna-define-class elsp-spamfilter (elsp-generic) - (good-corpus bad-corpus)) + (good-corpus bad-corpus modified)) (luna-define-internal-accessors 'elsp-spamfilter)) (luna-define-method initialize-instance :around ((processor elsp-spamfilter) @@ -66,11 +66,15 @@ (elsp-spamfilter-set-bad-corpus-internal processor spamf-bad-corpus) processor)) +(luna-define-method elmo-spam-modified-p ((processor elsp-spamfilter)) + (elsp-spamfilter-modified-internal processor)) + (luna-define-method elmo-spam-save-status ((processor elsp-spamfilter)) (spamf-save-corpus-to-file elmo-spam-spamfilter-corpus-filename (elsp-spamfilter-good-corpus-internal processor) - (elsp-spamfilter-bad-corpus-internal processor))) + (elsp-spamfilter-bad-corpus-internal processor)) + (elsp-spamfilter-set-modified-internal processor nil)) (defun elmo-spam-spamfilter-decode-buffer (buffer) (mime-display-message @@ -92,7 +96,8 @@ (elmo-spam-spamfilter-decode-buffer buffer) (spamf-register-good-buffer (current-buffer) - (elsp-spamfilter-good-corpus-internal processor)))) + (elsp-spamfilter-good-corpus-internal processor)) + (elsp-spamfilter-set-modified-internal processor t))) (luna-define-method elmo-spam-register-good-buffer ((processor elsp-spamfilter) buffer) @@ -100,7 +105,8 @@ (elmo-spam-spamfilter-decode-buffer buffer) (spamf-register-spam-buffer (current-buffer) - (elsp-spamfilter-bad-corpus-internal processor)))) + (elsp-spamfilter-bad-corpus-internal processor)) + (elsp-spamfilter-set-modified-internal processor t))) (require 'product) (product-provide (provide 'elsp-spamfilter) (require 'elmo-version)) diff --git a/wl/ChangeLog b/wl/ChangeLog index 2461d14..656f97b 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,3 +1,8 @@ +2003-10-25 Hiroya Murata + + * wl-spam.el (wl-spam-save-status): Call elmo-spam-save-status + when new optional argument `force' is non nil or modified. + 2003-10-21 Hiroya Murata * wl.el (toplevel): Require wl-spam when compile. diff --git a/wl/wl-spam.el b/wl/wl-spam.el index e038e88..5179cc0 100644 --- a/wl/wl-spam.el +++ b/wl/wl-spam.el @@ -106,9 +106,11 @@ numbers)) (message "Register good messages...done"))) -(defun wl-spam-save-status () - (interactive) - (elmo-spam-save-status (elmo-spam-processor))) +(defun wl-spam-save-status (&optional force) + (interactive "P") + (let ((processor (elmo-spam-processor))) + (when (or force (elmo-spam-modified-p processor)) + (elmo-spam-save-status processor)))) ;; insinuate into summary mode (defvar wl-summary-spam-map nil)