Function: spam-enter-list
spam-enter-list is a byte-compiled function defined in spam.el.gz.
Signature
(spam-enter-list ADDRESSES FILE &optional REMOVE)
Documentation
Enter ADDRESSES into the given FILE.
Either the whitelist or the blacklist files can be used. With a non-nil REMOVE, remove the ADDRESSES.
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/spam.el.gz
(defun spam-enter-list (addresses file &optional remove)
"Enter ADDRESSES into the given FILE.
Either the whitelist or the blacklist files can be used.
With a non-nil REMOVE, remove the ADDRESSES."
(if (stringp addresses)
(spam-enter-list (list addresses) file remove)
;; else, we have a list of addresses here
(unless (file-exists-p (file-name-directory file))
(make-directory (file-name-directory file) t))
(with-current-buffer
(find-file-noselect file)
(dolist (a addresses)
(when (stringp a)
(goto-char (point-min))
(if (re-search-forward (regexp-quote a) nil t)
;; found the address
(when remove
(spam-kill-whole-line))
;; else, the address was not found
(unless remove
(goto-char (point-max))
(unless (bobp)
(insert "\n"))
(insert a "\n")))))
(save-buffer))))