Function: spam-spamassassin-register-with-sa-learn

spam-spamassassin-register-with-sa-learn is a byte-compiled function defined in spam.el.gz.

Signature

(spam-spamassassin-register-with-sa-learn ARTICLES SPAM &optional UNREGISTER)

Documentation

Register articles with spamassassin's sa-learn as spam or non-spam.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/spam.el.gz
(defun spam-spamassassin-register-with-sa-learn (articles spam
                                                 &optional unregister)
  "Register articles with spamassassin's sa-learn as spam or non-spam."
  (if articles
      (let ((action (if unregister spam-sa-learn-unregister-switch
                      (if spam spam-sa-learn-spam-switch
                        spam-sa-learn-ham-switch)))
            (summary-buffer-name (buffer-name)))
        (with-temp-buffer
          ;; group the articles into mbox format
          (dolist (article articles)
            (let (article-string)
              (with-current-buffer summary-buffer-name
                (setq article-string (spam-get-article-as-string article)))
              (when (stringp article-string)
                ;; mbox separator
                (insert (concat "From nobody " (current-time-string) "\n"))
                (insert article-string)
                (insert "\n"))))
          ;; call sa-learn on all messages at the same time
          (apply #'call-process-region
                 (point-min) (point-max)
                 spam-sa-learn-program
                 nil nil nil "--mbox"
                 (if spam-sa-learn-rebuild
                     (list action)
                   `("--no-rebuild" ,action)))))))