Function: gnus-list-of-unread-articles
gnus-list-of-unread-articles is an autoloaded and byte-compiled
function defined in gnus-sum.el.gz.
Signature
(gnus-list-of-unread-articles GROUP)
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/gnus-sum.el.gz
;; This function returns a list of article numbers based on the
;; difference between the ranges of read articles in this group and
;; the range of active articles.
(defun gnus-list-of-unread-articles (group)
(let* ((read (gnus-info-read (gnus-get-info group)))
(active (or (gnus-active group) (gnus-activate-group group)))
(last (or (cdr active)
(error "Group %s couldn't be activated " group)))
(bottom (if gnus-newsgroup-maximum-articles
(max (car active)
(- last gnus-newsgroup-maximum-articles -1))
(car active)))
first nlast unread)
;; If none are read, then all are unread.
(if (not read)
(setq first bottom)
;; If the range of read articles is a single range, then the
;; first unread article is the article after the last read
;; article. Sounds logical, doesn't it?
(if (and (not (listp (cdr read)))
(or (< (car read) bottom)
(progn (setq read (list read))
nil)))
(setq first (max bottom (1+ (cdr read))))
;; `read' is a list of ranges.
(when (/= (setq nlast (or (and (numberp (car read)) (car read))
(caar read)))
1)
(setq first bottom))
(while read
(when first
(while (< first nlast)
(setq unread (cons first unread)
first (1+ first))))
(setq first (1+ (if (atom (car read)) (car read) (cdar read))))
(setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
(setq read (cdr read)))))
;; And add the last unread articles.
(while (<= first last)
(setq unread (cons first unread)
first (1+ first)))
;; Return the list of unread articles.
(delq 0 (nreverse unread))))