Function: gnus-execute
gnus-execute is an autoloaded and byte-compiled function defined in
gnus-kill.el.gz.
Signature
(gnus-execute FIELD REGEXP FORM &optional BACKWARD UNREAD)
Documentation
If FIELD of article header matches REGEXP, execute Lisp FORM (or a string).
If FIELD is an empty string (or nil), entire article body is searched for. If optional 1st argument BACKWARD is non-nil, do backward instead. If optional 2nd argument UNREAD is non-nil, articles which are marked as read or ticked are ignored.
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/gnus-kill.el.gz
(defun gnus-execute (field regexp form &optional backward unread)
"If FIELD of article header matches REGEXP, execute Lisp FORM (or a string).
If FIELD is an empty string (or nil), entire article body is searched for.
If optional 1st argument BACKWARD is non-nil, do backward instead.
If optional 2nd argument UNREAD is non-nil, articles which are
marked as read or ticked are ignored."
(save-excursion
(let ((killed-no 0)
function article header extras)
(cond
;; Search body.
((or (null field)
(string-equal field ""))
(setq function nil))
;; Get access function of header field.
((cond ((fboundp
(setq function
(intern-soft
(concat "mail-header-" (downcase field))))))
((when (setq extras
(member (downcase field)
(mapcar (lambda (header)
(downcase (symbol-name header)))
gnus-extra-headers)))
(setq function
(let ((type (nth (- (length gnus-extra-headers)
(length extras))
gnus-extra-headers)))
(lambda (h) (gnus-extra-header type h))))))))
;; Signal error.
(t
(error "Unknown header field: \"%s\"" field)))
;; Starting from the current article.
(while (or
;; First article.
(and (not article)
(setq article (gnus-summary-article-number)))
;; Find later articles.
(setq article
(gnus-summary-search-forward unread nil backward)))
(and (or (null gnus-newsgroup-kill-headers)
(memq article gnus-newsgroup-kill-headers))
(vectorp (setq header (gnus-summary-article-header article)))
(gnus-execute-1 function regexp form header)
(setq killed-no (1+ killed-no))))
;; Return the number of killed articles.
killed-no)))