Mercurial > emacs
comparison lisp/mh-e/mh-junk.el @ 56406:d36b00b98db0
Upgraded to MH-E version 7.4.4.
See etc/MH-E-NEWS and lisp/mh-e/ChangeLog for details.
author | Bill Wohler <wohler@newt.com> |
---|---|
date | Tue, 13 Jul 2004 03:06:25 +0000 |
parents | 695cf19ef79e |
children | e9a6cbc8ca5e 97905c4f1a42 |
comparison
equal
deleted
inserted
replaced
56405:10b68aa88abe | 56406:d36b00b98db0 |
---|---|
34 | 34 |
35 (require 'mh-e) | 35 (require 'mh-e) |
36 | 36 |
37 ;; Interactive functions callable from the folder buffer | 37 ;; Interactive functions callable from the folder buffer |
38 ;;;###mh-autoload | 38 ;;;###mh-autoload |
39 (defun mh-junk-blacklist (msg-or-seq) | 39 (defun mh-junk-blacklist (range) |
40 "Blacklist MSG-OR-SEQ as spam. | 40 "Blacklist RANGE as spam. |
41 Default is the displayed message. | 41 |
42 If optional prefix argument is provided, then prompt for the message sequence. | 42 Check the documentation of `mh-interactive-range' to see how RANGE is read in |
43 If variable `transient-mark-mode' is non-nil and the mark is active, then the | 43 interactive use. |
44 selected region is blacklisted. | |
45 In a program, MSG-OR-SEQ can be a message number, a list of message numbers, a | |
46 region in a cons cell, or a sequence. | |
47 | 44 |
48 First the appropriate function is called depending on the value of | 45 First the appropriate function is called depending on the value of |
49 `mh-junk-choice'. Then if `mh-junk-mail-folder' is a string then the message is | 46 `mh-junk-choice'. Then if `mh-junk-mail-folder' is a string then the message is |
50 refiled to that folder. If nil, the message is deleted. | 47 refiled to that folder. If nil, the message is deleted. |
51 | 48 |
56 for the different spam fighting programs: | 53 for the different spam fighting programs: |
57 | 54 |
58 - `mh-bogofilter-blacklist' | 55 - `mh-bogofilter-blacklist' |
59 - `mh-spamprobe-blacklist' | 56 - `mh-spamprobe-blacklist' |
60 - `mh-spamassassin-blacklist'" | 57 - `mh-spamassassin-blacklist'" |
61 (interactive (list (mh-interactive-msg-or-seq "Blacklist"))) | 58 (interactive (list (mh-interactive-range "Blacklist"))) |
62 (let ((blacklist-func (nth 1 (assoc mh-junk-choice mh-junk-function-alist)))) | 59 (let ((blacklist-func (nth 1 (assoc mh-junk-choice mh-junk-function-alist)))) |
63 (unless blacklist-func | 60 (unless blacklist-func |
64 (error "Customize `mh-junk-program' appropriately")) | 61 (error "Customize `mh-junk-program' appropriately")) |
65 (let ((dest (cond ((null mh-junk-mail-folder) nil) | 62 (let ((dest (cond ((null mh-junk-mail-folder) nil) |
66 ((equal mh-junk-mail-folder "") "+") | 63 ((equal mh-junk-mail-folder "") "+") |
68 mh-junk-mail-folder) | 65 mh-junk-mail-folder) |
69 ((eq (aref mh-junk-mail-folder 0) ?@) | 66 ((eq (aref mh-junk-mail-folder 0) ?@) |
70 (concat mh-current-folder "/" | 67 (concat mh-current-folder "/" |
71 (substring mh-junk-mail-folder 1))) | 68 (substring mh-junk-mail-folder 1))) |
72 (t (concat "+" mh-junk-mail-folder))))) | 69 (t (concat "+" mh-junk-mail-folder))))) |
73 (mh-iterate-on-msg-or-seq msg msg-or-seq | 70 (mh-iterate-on-range msg range |
74 (funcall (symbol-function blacklist-func) msg) | 71 (funcall (symbol-function blacklist-func) msg) |
75 (if dest | 72 (if dest |
76 (mh-refile-a-msg nil (intern dest)) | 73 (mh-refile-a-msg nil (intern dest)) |
77 (mh-delete-a-msg nil))) | 74 (mh-delete-a-msg nil))) |
78 (mh-next-msg)))) | 75 (mh-next-msg)))) |
79 | 76 |
80 ;;;###mh-autoload | 77 ;;;###mh-autoload |
81 (defun mh-junk-whitelist (msg-or-seq) | 78 (defun mh-junk-whitelist (range) |
82 "Whitelist MSG-OR-SEQ incorrectly classified as spam. | 79 "Whitelist RANGE incorrectly classified as spam. |
83 Default is the displayed message. | 80 |
84 If optional prefix argument is provided, then prompt for the message sequence. | 81 Check the documentation of `mh-interactive-range' to see how RANGE is read in |
85 If variable `transient-mark-mode' is non-nil and the mark is active, then the | 82 interactive use. |
86 selected region is whitelisted. | |
87 In a program, MSG-OR-SEQ can be a message number, a list of message numbers, a | |
88 region in a cons cell, or a sequence. | |
89 | 83 |
90 First the appropriate function is called depending on the value of | 84 First the appropriate function is called depending on the value of |
91 `mh-junk-choice'. Then the message is refiled to `mh-inbox'. | 85 `mh-junk-choice'. Then the message is refiled to `mh-inbox'. |
92 | 86 |
93 To change the spam program being used, customize `mh-junk-program'. Directly | 87 To change the spam program being used, customize `mh-junk-program'. Directly |
94 setting `mh-junk-choice' is not recommended." | 88 setting `mh-junk-choice' is not recommended." |
95 (interactive (list (mh-interactive-msg-or-seq "Whitelist"))) | 89 (interactive (list (mh-interactive-range "Whitelist"))) |
96 (let ((whitelist-func (nth 2 (assoc mh-junk-choice mh-junk-function-alist)))) | 90 (let ((whitelist-func (nth 2 (assoc mh-junk-choice mh-junk-function-alist)))) |
97 (unless whitelist-func | 91 (unless whitelist-func |
98 (error "Customize `mh-junk-program' appropriately")) | 92 (error "Customize `mh-junk-program' appropriately")) |
99 (mh-iterate-on-msg-or-seq msg msg-or-seq | 93 (mh-iterate-on-range msg range |
100 (funcall (symbol-function whitelist-func) msg) | 94 (funcall (symbol-function whitelist-func) msg) |
101 (mh-refile-a-msg nil (intern mh-inbox))) | 95 (mh-refile-a-msg nil (intern mh-inbox))) |
102 (mh-next-msg))) | 96 (mh-next-msg))) |
103 | 97 |
104 | 98 |
300 (call-process mh-spamassassin-executable msg-file mh-log-buffer nil | 294 (call-process mh-spamassassin-executable msg-file mh-log-buffer nil |
301 "--report" "--remove-from-whitelist") | 295 "--report" "--remove-from-whitelist") |
302 (when mh-sa-learn-executable | 296 (when mh-sa-learn-executable |
303 (message "Recategorizing this message as spam...") | 297 (message "Recategorizing this message as spam...") |
304 (call-process mh-sa-learn-executable msg-file mh-log-buffer nil | 298 (call-process mh-sa-learn-executable msg-file mh-log-buffer nil |
305 "--single" "--spam" "--local --no-rebuild")) | 299 "--single" "--spam" "--local" "--no-rebuild")) |
306 (message "Blacklisting address...") | 300 (message "Blacklisting address...") |
307 (set-buffer (get-buffer-create mh-temp-buffer)) | 301 (set-buffer (get-buffer-create mh-temp-buffer)) |
308 (erase-buffer) | 302 (erase-buffer) |
309 (call-process (expand-file-name mh-scan-prog mh-progs) nil t nil | 303 (call-process (expand-file-name mh-scan-prog mh-progs) nil t nil |
310 (format "%s" msg) current-folder | 304 (format "%s" msg) current-folder |