Function: gnus-sequence-of-unread-articles
gnus-sequence-of-unread-articles is a byte-compiled function defined
in gnus-sum.el.gz.
Signature
(gnus-sequence-of-unread-articles GROUP)
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/gnus-sum.el.gz
;; This function returns a sequence of article numbers based on the
;; difference between the ranges of read articles in this group and
;; the range of active articles.
(defun gnus-sequence-of-unread-articles (group)
(let* ((read (gnus-info-read (gnus-get-info group)))
(active (or (gnus-active group) (gnus-activate-group group)))
(last (cdr active))
(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
(push (cons first nlast) unread))
(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.
(cond ((not (and first last))
nil)
((< first last)
(push (cons first last) unread))
((= first last)
(push first unread)))
;; Return the sequence of unread articles.
(delq 0 (nreverse unread))))