From 89dbf3283d963e221a253faca2c2c7d620f72d95 Mon Sep 17 00:00:00 2001 From: Teodor Zlatanov Date: Wed, 1 Jan 2003 21:26:54 +0000 Subject: [PATCH] (spam-ham-marks, spam-spam-marks): changed list customization and list itself to store mark symbol rather than mark character. (spam-bogofilter-register-routine): added logic to generate mark values list from spam-ham-marks and spam-spam-marks, so (member) would work. --- lisp/ChangeLog | 9 +++++++++ lisp/spam.el | 33 ++++++++++++++++++++++++++------- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 64adeb33c..cb4f1d256 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2003-01-01 Teodor Zlatanov + + * spam.el (spam-ham-marks, spam-spam-marks): changed list + customization and list itself to store mark symbol rather than + mark character. + (spam-bogofilter-register-routine): added logic to generate mark + values list from spam-ham-marks and spam-spam-marks, so (member) + would work. + 2003-01-01 Raymond Scholz * message.el (message-signature-insert-empty-line): New variable. diff --git a/lisp/spam.el b/lisp/spam.el index 34a9a21e9..a8d02a019 100644 --- a/lisp/spam.el +++ b/lisp/spam.el @@ -36,6 +36,8 @@ (require 'gnus-sum) +(require 'gnus-uu) ; because of key prefix issues + ;; FIXME! We should not require `message' until we actually need ;; them. Best would be to declare needed functions as auto-loadable. (require 'message) @@ -140,16 +142,25 @@ All unmarked article in such group receive the spam mark on group entry." :type '(repeat (string :tag "Server")) :group 'spam) -(defcustom spam-ham-marks (list gnus-del-mark gnus-read-mark gnus-killed-mark gnus-kill-file-mark gnus-low-score-mark) +(defcustom spam-ham-marks (list 'gnus-del-mark 'gnus-read-mark 'gnus-killed-mark 'gnus-kill-file-mark 'gnus-low-score-mark) "Marks considered as being ham (positively not spam). Such articles will be processed as ham (non-spam) on group exit." - :type '(repeat (character :tag "Mark")) + :type '(set + (variable-item gnus-del-mark) + (variable-item gnus-read-mark) + (variable-item gnus-killed-mark) + (variable-item gnus-kill-file-mark) + (variable-item gnus-low-score-mark)) :group 'spam) -(defcustom spam-spam-marks (list gnus-spam-mark) +(defcustom spam-spam-marks (list 'gnus-spam-mark) "Marks considered as being spam (positively spam). Such articles will be transmitted to `bogofilter -s' on group exit." - :type '(repeat (character :tag "Mark")) + :type '(set + (variable-item gnus-spam-mark) + (variable-item gnus-killed-mark) + (variable-item gnus-kill-file-mark) + (variable-item gnus-low-score-mark)) :group 'spam) (defcustom spam-face 'gnus-splash-face @@ -516,13 +527,21 @@ spamicity coefficient of each, and the overall article spamicity." (defun spam-bogofilter-register-routine () (when (and spam-use-bogofilter spam-bogofilter-path) (let ((articles gnus-newsgroup-articles) - article mark ham-articles spam-articles) + article mark ham-articles spam-articles spam-mark-values ham-mark-values) + + ;; marks are stored as symbolic values, so we have to dereference them for memq to work + (dolist (mark spam-ham-marks) + (push (symbol-value mark) ham-mark-values)) + + (dolist (mark spam-spam-marks) + (push (symbol-value mark) spam-mark-values)) + (while articles (setq article (pop articles) mark (gnus-summary-article-mark article)) - (cond ((memq mark spam-spam-marks) (push article spam-articles)) + (cond ((memq mark spam-mark-values) (push article spam-articles)) ((memq article gnus-newsgroup-saved)) - ((memq mark spam-ham-marks) (push article ham-articles)))) + ((memq mark ham-mark-values) (push article ham-articles)))) (when ham-articles (spam-bogofilter-articles "ham" "-n" ham-articles)) (when spam-articles -- 2.34.1