From: yamaoka Date: Sat, 19 Oct 2002 06:16:16 +0000 (+0000) Subject: Synch with Oort Gnus. X-Git-Tag: t-gnus-6_15_8-05-quimby~22 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=ed7029cc54857a6e3e4dcb6841add165ae56814e;p=elisp%2Fgnus.git- Synch with Oort Gnus. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index be4bc33..6e79990 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -17,6 +17,12 @@ gnus-agent-consider-all-articles, maybe get all articles. (gnus-category-predicate-alist, gnus-agent-read-p): New predicate `read'. + (gnus-predicate-imples-unread): New function. + (gnus-agent-fetch-headers): Optimize to call + gnus-list-of-unread-articles if that is sufficient. + Check unseen and recent instead of seen and recent. + (gnus-agent-fetch-headers): Abstain from calling + gnus-list-range-intersection if range (a . b) would have (> a b). 2002-10-18 Katsumi Yamaoka diff --git a/lisp/gnus-agent.el b/lisp/gnus-agent.el index 079f294..6f0e90e 100644 --- a/lisp/gnus-agent.el +++ b/lisp/gnus-agent.el @@ -1106,31 +1106,43 @@ This can be added to `gnus-select-article-hook' or (pop gnus-agent-group-alist)))) (defun gnus-agent-fetch-headers (group &optional force) - (let* ((articles - (if gnus-agent-consider-all-articles - (gnus-uncompress-range (gnus-active group)) - (gnus-list-of-unread-articles group))) - (len (length articles)) - (gnus-decode-encoded-word-function 'identity) - (file (gnus-agent-article-name ".overview" group)) - i gnus-agent-cache) - ;; Check the number of articles is not too large. + (let ((articles + (if (and gnus-agent-consider-all-articles + ;; Do not fetch all headers if the predicate + ;; implies that we only consider unread articles. + (not (gnus-predicate-implies-unread + (or (gnus-group-find-parameter + group 'agent-predicate t) + (cadr (gnus-group-category group)))))) + (gnus-uncompress-range (gnus-active group)) + (gnus-list-of-unread-articles group))) + (gnus-decode-encoded-word-function 'identity) + (file (gnus-agent-article-name ".overview" group)) + gnus-agent-cache) + ;; Check whether the number of articles is not too large. (when (and (integerp gnus-agent-large-newsgroup) - (< 0 gnus-agent-large-newsgroup)) - (and (< 0 (setq i (- len gnus-agent-large-newsgroup))) - (setq articles (nthcdr i articles)))) - ;; add article with marks to list of article headers we want to fetch. + (> gnus-agent-large-newsgroup 0)) + (setq articles (nthcdr (max (- (length articles) + gnus-agent-large-newsgroup) + 0) + articles))) + ;; Add article with marks to list of article headers we want to fetch. (dolist (arts (gnus-info-marks (gnus-get-info group))) - (unless (memq (car arts) '(seen recent)) + (unless (memq (car arts) '(unseen recent)) (setq articles (gnus-range-add articles (cdr arts))))) (setq articles (sort (gnus-uncompress-sequence articles) '<)) ;; Remove known articles. (when (gnus-agent-load-alist group) - (setq articles (gnus-list-range-intersection - articles - (list - (cons (1+ (caar (last gnus-agent-article-alist))) - (cdr (gnus-active group))))))) + (let ((low (1+ (caar (last gnus-agent-article-alist)))) + (high (cdr (gnus-active group)))) + ;; I suspect a deeper problem here and I suspect that low + ;; should never be greater than high. But for the time being + ;; we just work around the problem and abstain from frobbing + ;; the article list in that case. If anyone knows how to + ;; properly deal with it, please holler. -- kai + (when (<= low high) + (setq articles (gnus-list-range-intersection + articles (list (cons low high))))))) ;; Fetch them. (gnus-make-directory (nnheader-translate-file-chars (file-name-directory file) t)) @@ -1706,6 +1718,14 @@ The following commands are available: (list (cons predicate func)))) func))) +(defun gnus-predicate-implies-unread (predicate) + "Say whether PREDICATE implies unread articles only. +It is okay to miss some cases, but there must be no false positives. +That is, if this function returns true, then indeed the predicate must +return only unread articles." + ;; Todo: make this work in more cases. + (equal predicate '(not read))) + (defun gnus-group-category (group) "Return the category GROUP belongs to." (unless gnus-category-group-cache