Function: rsf-add-region-to-spam-list
rsf-add-region-to-spam-list is an interactive and byte-compiled
function defined in rmail-spam-filter.el.gz.
Signature
(rsf-add-region-to-spam-list)
Documentation
Add the marked region in the Rmail buffer to the spam list.
Adds to spam definitions as a "contents" field.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/mail/rmail-spam-filter.el.gz
(defun rsf-add-region-to-spam-list ()
"Add the marked region in the Rmail buffer to the spam list.
Adds to spam definitions as a \"contents\" field."
(interactive)
(set-buffer rmail-buffer)
;; Check if region is inactive or has zero size.
(if (not (and mark-active (not (= (region-beginning) (region-end)))))
;; If inactive, print error message.
(message "You must highlight some text in the Rmail buffer")
(if (< (- (region-end) (region-beginning)) rsf-min-region-to-spam-list)
(message "Region is too small (minimum %d characters)"
rsf-min-region-to-spam-list)
;; If region active and long enough, add to list of spam definitions.
(let ((region-to-spam-list (regexp-quote
(buffer-substring-no-properties
(region-beginning) (region-end)))))
(add-to-list 'rsf-definitions-alist
(list '(from . "")
'(to . "")
'(subject . "")
'(content-type . "")
`(contents . ,region-to-spam-list)
'(action . output-and-delete))
t)
(customize-mark-to-save 'rsf-definitions-alist)
(if rsf-autosave-newly-added-definitions
(progn
(custom-save-all)
(message "Added highlighted text:\n%s\n\
to the spam list, and saved it" region-to-spam-list))
(message "Added highlighted text:\n%s\n\
to the spam list (remember to save it)" region-to-spam-list))))))