Function: mh-spamassassin-add-rule
mh-spamassassin-add-rule is a byte-compiled function defined in
mh-junk.el.gz.
Signature
(mh-spamassassin-add-rule RULE BODY)
Documentation
Add a new rule to "~/.spamassassin/user_prefs".
The name of the rule is RULE and its body is BODY.
Source Code
;; Defined in /usr/src/emacs/lisp/mh-e/mh-junk.el.gz
(defun mh-spamassassin-add-rule (rule body)
"Add a new rule to \"~/.spamassassin/user_prefs\".
The name of the rule is RULE and its body is BODY."
(save-window-excursion
(let* ((line (format "%s\t%s\n" rule body))
(case-fold-search t)
(file (expand-file-name "~/.spamassassin/user_prefs"))
(buffer-exists (find-buffer-visiting file)))
(find-file file)
(if (not (search-forward (format "\n%s" line) nil t))
(progn
(goto-char (point-max))
(insert (if (bolp) "" "\n") line)
(save-buffer)))
(if (not buffer-exists)
(kill-buffer nil)))))