diff options
Diffstat (limited to 'lisp/gnus/spam.el')
-rw-r--r-- | lisp/gnus/spam.el | 377 |
1 files changed, 183 insertions, 194 deletions
diff --git a/lisp/gnus/spam.el b/lisp/gnus/spam.el index 22810332b65..f7288c98f6f 100644 --- a/lisp/gnus/spam.el +++ b/lisp/gnus/spam.el @@ -1,4 +1,4 @@ -;;; spam.el --- Identifying spam +;;; spam.el --- Identifying spam -*- lexical-binding: t; -*- ;; Copyright (C) 2002-2021 Free Software Foundation, Inc. @@ -321,8 +321,8 @@ Default to t if one of the spam-use-* variables is set." :type 'string :group 'spam) -;;; TODO: deprecate this variable, it's confusing since it's a list of strings, -;;; not regular expressions +;; TODO: deprecate this variable, it's confusing since it's a list of strings, +;; not regular expressions (defcustom spam-junk-mailgroups (cons spam-split-group '("mail.junk" "poste.pourriel")) @@ -705,7 +705,7 @@ finds ham or spam.") "Clear the `spam-caches' entry for a check." (remhash symbol spam-caches)) -(define-obsolete-function-alias 'spam-xor 'xor "27.1") +(define-obsolete-function-alias 'spam-xor #'xor "27.1") (defun spam-set-difference (list1 list2) "Return a set difference of LIST1 and LIST2. @@ -727,7 +727,7 @@ When either list is nil, the other is returned." (let* ((marks (spam-group-ham-marks group spam)) (marks (if (symbolp mark) marks - (mapcar 'symbol-value marks)))) + (mapcar #'symbol-value marks)))) (memq mark marks)))) (defun spam-group-spam-mark-p (group mark) @@ -1014,28 +1014,28 @@ backends)." ;;{{{ backend installations (spam-install-checkonly-backend 'spam-use-blackholes - 'spam-check-blackholes) + #'spam-check-blackholes) (spam-install-checkonly-backend 'spam-use-hashcash - 'spam-check-hashcash) + #'spam-check-hashcash) (spam-install-checkonly-backend 'spam-use-spamassassin-headers - 'spam-check-spamassassin-headers) + #'spam-check-spamassassin-headers) (spam-install-checkonly-backend 'spam-use-bogofilter-headers - 'spam-check-bogofilter-headers) + #'spam-check-bogofilter-headers) (spam-install-checkonly-backend 'spam-use-bsfilter-headers - 'spam-check-bsfilter-headers) + #'spam-check-bsfilter-headers) (spam-install-checkonly-backend 'spam-use-gmane-xref - 'spam-check-gmane-xref) + #'spam-check-gmane-xref) (spam-install-checkonly-backend 'spam-use-regex-headers - 'spam-check-regex-headers) + #'spam-check-regex-headers) (spam-install-statistical-checkonly-backend 'spam-use-regex-body - 'spam-check-regex-body) + #'spam-check-regex-body) ;; TODO: NOTE: spam-use-ham-copy is now obsolete, use (ham spam-use-copy) (spam-install-mover-backend 'spam-use-move @@ -1045,94 +1045,94 @@ backends)." nil) (spam-install-nocheck-backend 'spam-use-copy - 'spam-copy-ham-routine - 'spam-copy-spam-routine + #'spam-copy-ham-routine + #'spam-copy-spam-routine nil nil) (spam-install-nocheck-backend 'spam-use-gmane - 'spam-report-gmane-unregister-routine - 'spam-report-gmane-register-routine - 'spam-report-gmane-register-routine - 'spam-report-gmane-unregister-routine) + #'spam-report-gmane-unregister-routine + #'spam-report-gmane-register-routine + #'spam-report-gmane-register-routine + #'spam-report-gmane-unregister-routine) (spam-install-nocheck-backend 'spam-use-resend - 'spam-report-resend-register-ham-routine - 'spam-report-resend-register-routine + #'spam-report-resend-register-ham-routine + #'spam-report-resend-register-routine nil nil) (spam-install-backend 'spam-use-BBDB - 'spam-check-BBDB - 'spam-BBDB-register-routine + #'spam-check-BBDB + #'spam-BBDB-register-routine nil - 'spam-BBDB-unregister-routine + #'spam-BBDB-unregister-routine nil) (spam-install-backend-alias 'spam-use-BBDB 'spam-use-BBDB-exclusive) (spam-install-backend 'spam-use-blacklist - 'spam-check-blacklist + #'spam-check-blacklist nil - 'spam-blacklist-register-routine + #'spam-blacklist-register-routine nil - 'spam-blacklist-unregister-routine) + #'spam-blacklist-unregister-routine) (spam-install-backend 'spam-use-whitelist - 'spam-check-whitelist - 'spam-whitelist-register-routine + #'spam-check-whitelist + #'spam-whitelist-register-routine nil - 'spam-whitelist-unregister-routine + #'spam-whitelist-unregister-routine nil) (spam-install-statistical-backend 'spam-use-ifile - 'spam-check-ifile - 'spam-ifile-register-ham-routine - 'spam-ifile-register-spam-routine - 'spam-ifile-unregister-ham-routine - 'spam-ifile-unregister-spam-routine) + #'spam-check-ifile + #'spam-ifile-register-ham-routine + #'spam-ifile-register-spam-routine + #'spam-ifile-unregister-ham-routine + #'spam-ifile-unregister-spam-routine) (spam-install-statistical-backend 'spam-use-spamoracle - 'spam-check-spamoracle - 'spam-spamoracle-learn-ham - 'spam-spamoracle-learn-spam - 'spam-spamoracle-unlearn-ham - 'spam-spamoracle-unlearn-spam) + #'spam-check-spamoracle + #'spam-spamoracle-learn-ham + #'spam-spamoracle-learn-spam + #'spam-spamoracle-unlearn-ham + #'spam-spamoracle-unlearn-spam) (spam-install-statistical-backend 'spam-use-stat - 'spam-check-stat - 'spam-stat-register-ham-routine - 'spam-stat-register-spam-routine - 'spam-stat-unregister-ham-routine - 'spam-stat-unregister-spam-routine) + #'spam-check-stat + #'spam-stat-register-ham-routine + #'spam-stat-register-spam-routine + #'spam-stat-unregister-ham-routine + #'spam-stat-unregister-spam-routine) (spam-install-statistical-backend 'spam-use-spamassassin - 'spam-check-spamassassin - 'spam-spamassassin-register-ham-routine - 'spam-spamassassin-register-spam-routine - 'spam-spamassassin-unregister-ham-routine - 'spam-spamassassin-unregister-spam-routine) + #'spam-check-spamassassin + #'spam-spamassassin-register-ham-routine + #'spam-spamassassin-register-spam-routine + #'spam-spamassassin-unregister-ham-routine + #'spam-spamassassin-unregister-spam-routine) (spam-install-statistical-backend 'spam-use-bogofilter - 'spam-check-bogofilter - 'spam-bogofilter-register-ham-routine - 'spam-bogofilter-register-spam-routine - 'spam-bogofilter-unregister-ham-routine - 'spam-bogofilter-unregister-spam-routine) + #'spam-check-bogofilter + #'spam-bogofilter-register-ham-routine + #'spam-bogofilter-register-spam-routine + #'spam-bogofilter-unregister-ham-routine + #'spam-bogofilter-unregister-spam-routine) (spam-install-statistical-backend 'spam-use-bsfilter - 'spam-check-bsfilter - 'spam-bsfilter-register-ham-routine - 'spam-bsfilter-register-spam-routine - 'spam-bsfilter-unregister-ham-routine - 'spam-bsfilter-unregister-spam-routine) + #'spam-check-bsfilter + #'spam-bsfilter-register-ham-routine + #'spam-bsfilter-register-spam-routine + #'spam-bsfilter-unregister-ham-routine + #'spam-bsfilter-unregister-spam-routine) (spam-install-statistical-backend 'spam-use-crm114 - 'spam-check-crm114 - 'spam-crm114-register-ham-routine - 'spam-crm114-register-spam-routine - 'spam-crm114-unregister-ham-routine - 'spam-crm114-unregister-spam-routine) + #'spam-check-crm114 + #'spam-crm114-register-ham-routine + #'spam-crm114-register-spam-routine + #'spam-crm114-unregister-ham-routine + #'spam-crm114-unregister-spam-routine) ;;}}} ;;{{{ scoring and summary formatting @@ -1387,7 +1387,7 @@ In the case of mover backends, checks the setting of (gnus-check-backend-function 'request-move-article gnus-newsgroup-name)) (respool-method (gnus-find-method-for-group gnus-newsgroup-name)) - article mark deletep respool valid-move-destinations) + deletep respool valid-move-destinations) ;; article mark (when (member 'respool groups) (setq respool t) ; boolean for later @@ -1709,7 +1709,7 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." (if (or (null first-method) (equal first-method 'default)) (spam-split) - (apply 'spam-split methods)))))) + (apply #'spam-split methods)))))) (if (equal split-return 'spam) (gnus-summary-mark-article article gnus-spam-mark)) @@ -1807,7 +1807,7 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." (log-function (if unregister 'spam-log-undo-registration 'spam-log-processing-to-registry)) - article articles) + articles) ;; article (when run-function ;; make list of articles, using specific-articles if given @@ -1836,7 +1836,7 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." ;; return the number of articles processed (length articles)))) -;;; log a ham- or spam-processor invocation to the registry +;; log a ham- or spam-processor invocation to the registry (defun spam-log-processing-to-registry (id type classification backend group) (when spam-log-to-registry (if (and (stringp id) @@ -1855,7 +1855,7 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." "%s call with bad ID, type, classification, spam-backend, or group" "spam-log-processing-to-registry"))))) -;;; check if a ham- or spam-processor registration has been done +;; check if a ham- or spam-processor registration has been done (defun spam-log-registered-p (id type) (when spam-log-to-registry (if (and (stringp id) @@ -1868,8 +1868,8 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." "spam-log-registered-p")) nil)))) -;;; check what a ham- or spam-processor registration says -;;; returns nil if conflicting registrations are found +;; check what a ham- or spam-processor registration says +;; returns nil if conflicting registrations are found (defun spam-log-registration-type (id type) (let ((count 0) decision) @@ -1885,7 +1885,7 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." decision))) -;;; check if a ham- or spam-processor registration needs to be undone +;; check if a ham- or spam-processor registration needs to be undone (defun spam-log-unregistration-needed-p (id type classification backend) (when spam-log-to-registry (if (and (stringp id) @@ -1908,9 +1908,9 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." nil)))) -;;; undo a ham- or spam-processor registration (the group is not used) +;; undo a ham- or spam-processor registration (the group is not used) (defun spam-log-undo-registration (id type classification backend - &optional group) + &optional _group) (when (and spam-log-to-registry (spam-log-unregistration-needed-p id type classification backend)) (if (and (stringp id) @@ -1918,7 +1918,7 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." (spam-classification-valid-p classification) (spam-backend-valid-p backend)) (let ((cell-list (gnus-registry-get-id-key id type)) - new-cell-list found) + new-cell-list) ;; found (dolist (cell cell-list) (unless (and (eq classification (nth 0 cell)) (eq backend (nth 1 cell))) @@ -1981,7 +1981,7 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." (defun spam-reverse-ip-string (ip) (when (stringp ip) - (mapconcat 'identity + (mapconcat #'identity (nreverse (split-string ip "\\.")) "."))) @@ -2034,94 +2034,83 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." ;;{{{ BBDB -;;; original idea for spam-check-BBDB from Alexander Kotelnikov -;;; <sacha@giotto.sj.ru> +;; original idea for spam-check-BBDB from Alexander Kotelnikov +;; <sacha@giotto.sj.ru> ;; all this is done inside a condition-case to trap errors ;; Autoloaded in message, which we require. (declare-function gnus-extract-address-components "gnus-util" (from)) -(eval-and-compile - (condition-case nil - (progn - (require 'bbdb) - (require 'bbdb-com)) - (file-error - ;; `bbdb-records' should not be bound as an autoload function - ;; before loading bbdb because of `bbdb-hashtable-size'. - (defalias 'bbdb-buffer 'ignore) - (defalias 'bbdb-create-internal 'ignore) - (defalias 'bbdb-records 'ignore) - (defalias 'spam-BBDB-register-routine 'ignore) - (defalias 'spam-enter-ham-BBDB 'ignore) - (defalias 'spam-exists-in-BBDB-p 'ignore) - (defalias 'bbdb-gethash 'ignore) - nil))) - -(eval-and-compile - (when (featurep 'bbdb-com) - ;; when the BBDB changes, we want to clear out our cache - (defun spam-clear-cache-BBDB (&rest immaterial) - (spam-clear-cache 'spam-use-BBDB)) - - (add-hook 'bbdb-change-hook 'spam-clear-cache-BBDB) - - (defun spam-enter-ham-BBDB (addresses &optional remove) - "Enter an address into the BBDB; implies ham (non-spam) sender" - (dolist (from addresses) - (when (stringp from) - (let* ((parsed-address (gnus-extract-address-components from)) - (name (or (nth 0 parsed-address) "Ham Sender")) - (remove-function (if remove - 'bbdb-delete-record-internal - 'ignore)) - (net-address (nth 1 parsed-address)) - (record (and net-address - (spam-exists-in-BBDB-p net-address)))) - (when net-address - (gnus-message 6 "%s address %s %s BBDB" - (if remove "Deleting" "Adding") - from - (if remove "from" "to")) - (if record - (funcall remove-function record) - (bbdb-create-internal name nil net-address nil nil - "ham sender added by spam.el"))))))) - - (defun spam-BBDB-register-routine (articles &optional unregister) - (let (addresses) - (dolist (article articles) - (when (stringp (spam-fetch-field-from-fast article)) - (push (spam-fetch-field-from-fast article) addresses))) - ;; now do the register/unregister action - (spam-enter-ham-BBDB addresses unregister))) - - (defun spam-BBDB-unregister-routine (articles) - (spam-BBDB-register-routine articles t)) - - (defsubst spam-exists-in-BBDB-p (net) - (when (and (stringp net) (not (zerop (length net)))) - (bbdb-records) - (bbdb-gethash (downcase net)))) - - (defun spam-check-BBDB () - "Mail from people in the BBDB is classified as ham or non-spam" - (let ((net (message-fetch-field "from"))) - (when net - (setq net (nth 1 (gnus-extract-address-components net))) - (if (spam-exists-in-BBDB-p net) - t - (if spam-use-BBDB-exclusive - spam-split-group - nil))))))) +(require 'bbdb nil 'noerror) +(require 'bbdb-com nil 'noerror) + +(declare-function bbdb-records "bbdb" ()) +(declare-function bbdb-gethash "bbdb" (key &optional predicate)) +(declare-function bbdb-create-internal "bbdb-com" (&rest spec)) + +;; when the BBDB changes, we want to clear out our cache +(defun spam-clear-cache-BBDB (&rest _immaterial) + (spam-clear-cache 'spam-use-BBDB)) + +(when (featurep 'bbdb-com) + (add-hook 'bbdb-change-hook #'spam-clear-cache-BBDB)) + +(defun spam-enter-ham-BBDB (addresses &optional remove) + "Enter an address into the BBDB; implies ham (non-spam) sender" + (dolist (from addresses) + (when (stringp from) + (let* ((parsed-address (gnus-extract-address-components from)) + (name (or (nth 0 parsed-address) "Ham Sender")) + (remove-function (if remove + 'bbdb-delete-record-internal + 'ignore)) + (net-address (nth 1 parsed-address)) + (record (and net-address + (spam-exists-in-BBDB-p net-address)))) + (when net-address + (gnus-message 6 "%s address %s %s BBDB" + (if remove "Deleting" "Adding") + from + (if remove "from" "to")) + (if record + (funcall remove-function record) + (bbdb-create-internal name nil net-address nil nil + "ham sender added by spam.el"))))))) + +(defun spam-BBDB-register-routine (articles &optional unregister) + (let (addresses) + (dolist (article articles) + (when (stringp (spam-fetch-field-from-fast article)) + (push (spam-fetch-field-from-fast article) addresses))) + ;; now do the register/unregister action + (spam-enter-ham-BBDB addresses unregister))) + +(defun spam-BBDB-unregister-routine (articles) + (spam-BBDB-register-routine articles t)) + +(defun spam-exists-in-BBDB-p (net) + (when (and (stringp net) (not (zerop (length net)))) + (bbdb-records) + (bbdb-gethash (downcase net)))) + +(defun spam-check-BBDB () + "Mail from people in the BBDB is classified as ham or non-spam" + (let ((net (message-fetch-field "from"))) + (when net + (setq net (nth 1 (gnus-extract-address-components net))) + (if (spam-exists-in-BBDB-p net) + t + (if spam-use-BBDB-exclusive + spam-split-group + nil))))) ;;}}} ;;{{{ ifile -;;; check the ifile backend; return nil if the mail was NOT classified -;;; as spam +;; check the ifile backend; return nil if the mail was NOT classified +;; as spam (defun spam-get-ifile-database-parameter () @@ -2139,7 +2128,7 @@ See `spam-ifile-database'." (let ((temp-buffer-name (buffer-name)) (db-param (spam-get-ifile-database-parameter))) (with-current-buffer article-buffer-name - (apply 'call-process-region + (apply #'call-process-region (point-min) (point-max) spam-ifile-program nil temp-buffer-name nil "-c" (if db-param `(,db-param "-q") '("-q")))) @@ -2161,13 +2150,13 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)." (let ((category (or category gnus-newsgroup-name)) (add-or-delete-option (if unregister "-d" "-i")) (db (spam-get-ifile-database-parameter)) - parameters) + ) ;; parameters (with-temp-buffer (dolist (article articles) (let ((article-string (spam-get-article-as-string article))) (when (stringp article-string) (insert article-string)))) - (apply 'call-process-region + (apply #'call-process-region (point-min) (point-max) spam-ifile-program nil nil nil add-or-delete-option category @@ -2195,7 +2184,7 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)." "Check the spam-stat backend for the classification of this message." (let ((spam-stat-split-fancy-spam-group spam-split-group) ; override (spam-stat-buffer (buffer-name)) ; stat the current buffer - category return) + ) ;; category return (spam-stat-split-fancy))) (defun spam-stat-register-spam-routine (articles &optional unregister) @@ -2240,7 +2229,7 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)." (let ((kill-whole-line t)) (kill-line))) -;;; address can be a list, too +;; address can be a list, too (defun spam-enter-whitelist (address &optional remove) "Enter ADDRESS (list or single) into the whitelist. With a non-nil REMOVE, remove them." @@ -2249,7 +2238,7 @@ With a non-nil REMOVE, remove them." (setq spam-whitelist-cache nil) (spam-clear-cache 'spam-use-whitelist)) -;;; address can be a list, too +;; address can be a list, too (defun spam-enter-blacklist (address &optional remove) "Enter ADDRESS (list or single) into the blacklist. With a non-nil REMOVE, remove them." @@ -2310,8 +2299,8 @@ With a non-nil REMOVE, remove the ADDRESSES." (cl-return))) found))) -;;; returns t if the sender is in the whitelist, nil or -;;; spam-split-group otherwise +;; returns t if the sender is in the whitelist, nil or +;; spam-split-group otherwise (defun spam-check-whitelist () ;; FIXME! Should it detect when file timestamps change? (unless spam-whitelist-cache @@ -2346,7 +2335,7 @@ With a non-nil REMOVE, remove the ADDRESSES." (defun spam-from-listed-p (type) (let ((from (message-fetch-field "from")) - found) + ) ;; found (spam-filelist-check-cache type from))) (defun spam-filelist-register-routine (articles blacklist &optional unregister) @@ -2356,7 +2345,7 @@ With a non-nil REMOVE, remove the ADDRESSES." (if blacklist 'spam-enter-blacklist 'spam-enter-whitelist)) (remove-function (if blacklist 'spam-enter-whitelist 'spam-enter-blacklist)) - from addresses unregister-list article-unregister-list) + addresses unregister-list article-unregister-list) ;; from (dolist (article articles) (let ((from (spam-fetch-field-from-fast article)) (id (spam-fetch-field-message-id-fast article)) @@ -2406,11 +2395,11 @@ With a non-nil REMOVE, remove the ADDRESSES." ;;{{{ Spam-report glue (gmane and resend reporting) (defun spam-report-gmane-register-routine (articles) (when articles - (apply 'spam-report-gmane-spam articles))) + (apply #'spam-report-gmane-spam articles))) (defun spam-report-gmane-unregister-routine (articles) (when articles - (apply 'spam-report-gmane-ham articles))) + (apply #'spam-report-gmane-ham articles))) (defun spam-report-resend-register-ham-routine (articles) (spam-report-resend-register-routine articles t)) @@ -2474,7 +2463,7 @@ With a non-nil REMOVE, remove the ADDRESSES." (with-temp-buffer (let ((temp-buffer-name (buffer-name))) (with-current-buffer article-buffer-name - (apply 'call-process-region + (apply #'call-process-region (point-min) (point-max) spam-bogofilter-program nil temp-buffer-name nil @@ -2502,7 +2491,7 @@ With a non-nil REMOVE, remove the ADDRESSES." (with-temp-buffer (insert article-string) - (apply 'call-process-region + (apply #'call-process-region (point-min) (point-max) spam-bogofilter-program nil nil nil switch @@ -2532,7 +2521,7 @@ With a non-nil REMOVE, remove the ADDRESSES." (let ((temp-buffer-name (buffer-name))) (with-current-buffer article-buffer-name (let ((status - (apply 'call-process-region + (apply #'call-process-region (point-min) (point-max) spam-spamoracle-binary nil temp-buffer-name nil @@ -2559,7 +2548,7 @@ With a non-nil REMOVE, remove the ADDRESSES." "-spam" "-good")) (status - (apply 'call-process-region + (apply #'call-process-region (point-min) (point-max) spam-spamoracle-binary nil temp-buffer-name nil @@ -2573,13 +2562,13 @@ With a non-nil REMOVE, remove the ADDRESSES." (defun spam-spamoracle-learn-ham (articles &optional unregister) (spam-spamoracle-learn articles nil unregister)) -(defun spam-spamoracle-unlearn-ham (articles &optional unregister) +(defun spam-spamoracle-unlearn-ham (articles &optional _unregister) (spam-spamoracle-learn-ham articles t)) (defun spam-spamoracle-learn-spam (articles &optional unregister) (spam-spamoracle-learn articles t unregister)) -(defun spam-spamoracle-unlearn-spam (articles &optional unregister) +(defun spam-spamoracle-unlearn-spam (articles &optional _unregister) (spam-spamoracle-learn-spam articles t)) ;;}}} @@ -2607,7 +2596,7 @@ With a non-nil REMOVE, remove the ADDRESSES." (with-temp-buffer (let ((temp-buffer-name (buffer-name))) (with-current-buffer article-buffer-name - (apply 'call-process-region + (apply #'call-process-region (point-min) (point-max) spam-assassin-program nil temp-buffer-name nil spam-spamassassin-arguments)) ;; check the return now (we're back in the temp buffer) @@ -2648,7 +2637,7 @@ With a non-nil REMOVE, remove the ADDRESSES." (insert article-string) (insert "\n")))) ;; call sa-learn on all messages at the same time - (apply 'call-process-region + (apply #'call-process-region (point-min) (point-max) spam-sa-learn-program nil nil nil "--mbox" @@ -2703,7 +2692,7 @@ With a non-nil REMOVE, remove the ADDRESSES." (with-temp-buffer (let ((temp-buffer-name (buffer-name))) (with-current-buffer article-buffer-name - (apply 'call-process-region + (apply #'call-process-region (point-min) (point-max) spam-bsfilter-program nil temp-buffer-name nil @@ -2731,7 +2720,7 @@ With a non-nil REMOVE, remove the ADDRESSES." (when (stringp article-string) (with-temp-buffer (insert article-string) - (apply 'call-process-region + (apply #'call-process-region (point-min) (point-max) spam-bsfilter-program nil nil nil switch @@ -2788,7 +2777,7 @@ With a non-nil REMOVE, remove the ADDRESSES." (with-temp-buffer (let ((temp-buffer-name (buffer-name))) (with-current-buffer article-buffer-name - (apply 'call-process-region + (apply #'call-process-region (point-min) (point-max) spam-crm114-program nil temp-buffer-name nil @@ -2814,7 +2803,7 @@ With a non-nil REMOVE, remove the ADDRESSES." (with-temp-buffer (insert article-string) - (apply 'call-process-region + (apply #'call-process-region (point-min) (point-max) spam-crm114-program nil nil nil @@ -2859,13 +2848,13 @@ installed through `spam-necessary-extra-headers'." (push '((eq mark gnus-spam-mark) . spam) gnus-summary-highlight) ;; Add hooks for loading and saving the spam stats - (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) - (add-hook 'gnus-summary-prepared-hook 'spam-find-spam) + (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) + (add-hook 'gnus-summary-prepared-hook #'spam-find-spam) ;; Don't install things more than once. (setq spam-install-hooks nil))) @@ -2873,15 +2862,15 @@ installed through `spam-necessary-extra-headers'." "Uninstall the spam.el hooks." (interactive) (spam-teardown-widening) - (remove-hook 'gnus-save-newsrc-hook 'spam-maybe-spam-stat-save) - (remove-hook 'gnus-get-top-new-news-hook 'spam-maybe-spam-stat-load) - (remove-hook 'gnus-startup-hook 'spam-maybe-spam-stat-load) - (remove-hook 'gnus-summary-prepare-exit-hook 'spam-summary-prepare-exit) - (remove-hook 'gnus-summary-prepare-hook 'spam-summary-prepare) - (remove-hook 'gnus-get-new-news-hook 'spam-setup-widening) - (remove-hook 'gnus-summary-prepare-hook 'spam-find-spam)) - -(add-hook 'spam-unload-hook 'spam-unload-hook) + (remove-hook 'gnus-save-newsrc-hook #'spam-maybe-spam-stat-save) + (remove-hook 'gnus-get-top-new-news-hook #'spam-maybe-spam-stat-load) + (remove-hook 'gnus-startup-hook #'spam-maybe-spam-stat-load) + (remove-hook 'gnus-summary-prepare-exit-hook #'spam-summary-prepare-exit) + (remove-hook 'gnus-summary-prepare-hook #'spam-summary-prepare) + (remove-hook 'gnus-get-new-news-hook #'spam-setup-widening) + (remove-hook 'gnus-summary-prepare-hook #'spam-find-spam)) + +(add-hook 'spam-unload-hook #'spam-unload-hook) ;;}}} |