Function: gnus-agent-uncached-articles
gnus-agent-uncached-articles is a byte-compiled function defined in
gnus-agent.el.gz.
Signature
(gnus-agent-uncached-articles ARTICLES GROUP &optional CACHED-HEADER)
Documentation
Restrict ARTICLES to numbers already fetched.
Returns a sublist of ARTICLES that excludes those article ids in GROUP that have already been fetched. If CACHED-HEADER is nil, articles are only excluded if the article itself has been fetched.
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/gnus-agent.el.gz
(defun gnus-agent-uncached-articles (articles group &optional cached-header)
"Restrict ARTICLES to numbers already fetched.
Returns a sublist of ARTICLES that excludes those article ids in GROUP
that have already been fetched.
If CACHED-HEADER is nil, articles are only excluded if the article itself
has been fetched."
;; Logically equivalent to: (gnus-sorted-difference articles (mapcar
;; #'car gnus-agent-article-alist))
;; Functionally, I don't need to construct a temp list using mapcar.
(if (and (or gnus-agent-cache (not gnus-plugged))
(gnus-agent-load-alist group))
(let* ((ref gnus-agent-article-alist)
(arts articles)
(uncached (list nil))
(tail-uncached uncached))
(while (and ref arts)
(let ((v1 (car arts))
(v2 (caar ref)))
(cond ((< v1 v2) ; v1 does not appear in the reference list
(gnus-agent-append-to-list tail-uncached v1)
(setq arts (cdr arts)))
((= v1 v2)
(unless (or cached-header (cdar ref)) ; v1 is already cached
(gnus-agent-append-to-list tail-uncached v1))
(setq arts (cdr arts))
(setq ref (cdr ref)))
(t ; reference article (v2) precedes the list being filtered
(setq ref (cdr ref))))))
(while arts
(gnus-agent-append-to-list tail-uncached (pop arts)))
(cdr uncached))
;; if gnus-agent-load-alist fails, no articles are cached.
articles))