Function: gnus-group-prepare-flat
gnus-group-prepare-flat is a byte-compiled function defined in
gnus-group.el.gz.
Signature
(gnus-group-prepare-flat LEVEL &optional PREDICATE LOWEST REGEXP)
Documentation
List all newsgroups with unread articles of level LEVEL or lower.
If PREDICATE is a function, list groups that the function returns non-nil; if it is t, list groups that have no unread articles. If LOWEST is non-nil, list all newsgroups of level LOWEST or higher. If REGEXP is a function, list dead groups that the function returns non-nil; if it is a string, only list groups matching REGEXP.
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/gnus-group.el.gz
(defun gnus-group-prepare-flat (level &optional predicate lowest regexp)
"List all newsgroups with unread articles of level LEVEL or lower.
If PREDICATE is a function, list groups that the function returns non-nil;
if it is t, list groups that have no unread articles.
If LOWEST is non-nil, list all newsgroups of level LOWEST or higher.
If REGEXP is a function, list dead groups that the function returns non-nil;
if it is a string, only list groups matching REGEXP."
(set-buffer gnus-group-buffer)
(let ((buffer-read-only nil)
(lowest (or lowest 1))
(not-in-list (and gnus-group-listed-groups
(copy-sequence gnus-group-listed-groups)))
info clevel unread group params)
(erase-buffer)
(when (or (< lowest gnus-level-zombie)
gnus-group-listed-groups)
;; List living groups, according to order in `gnus-group-list'.
(dolist (g (cdr gnus-group-list))
(setq info (gnus-get-info g)
group (gnus-info-group info)
params (gnus-info-params info)
unread (gnus-group-unread group))
(when not-in-list
(setq not-in-list (delete group not-in-list)))
(when (gnus-group-prepare-logic
group
(and (or unread ; This group might be unchecked
predicate) ; Check if this group should be listed
(or (not (stringp regexp))
(string-match regexp group))
(<= (setq clevel (gnus-info-level info)) level)
(>= clevel lowest)
(cond
((functionp predicate)
(funcall predicate info))
(predicate t) ; We list all groups?
(t
(or
(if (eq unread t) ; Inactive?
gnus-group-list-inactive-groups
; We list inactive
(and (numberp unread) (> unread 0)))
; We list groups with unread articles
(and gnus-list-groups-with-ticked-articles
(cdr (assq 'tick (gnus-info-marks info))))
; And groups with ticked articles
;; Check for permanent visibility.
(and gnus-permanently-visible-groups
(string-match gnus-permanently-visible-groups
group))
;; Marked groups are always visible.
(member group gnus-group-marked)
(memq 'visible params)
(cdr (assq 'visible params)))))))
(gnus-group-insert-group-line
group (gnus-info-level info)
(gnus-info-marks info) unread (gnus-info-method info)))))
;; List dead groups.
(when (or gnus-group-listed-groups
(and (>= level gnus-level-zombie)
(<= lowest gnus-level-zombie)))
(gnus-group-prepare-flat-list-dead
(setq gnus-zombie-list (sort gnus-zombie-list #'string<))
gnus-level-zombie ?Z
regexp))
(when not-in-list
(dolist (group gnus-zombie-list)
(setq not-in-list (delete group not-in-list))))
(when (or gnus-group-listed-groups
(and (>= level gnus-level-killed) (<= lowest gnus-level-killed)))
(gnus-group-prepare-flat-list-dead
(cl-union
not-in-list
(setq gnus-killed-list (sort gnus-killed-list #'string<))
:test 'equal)
gnus-level-killed ?K regexp))
(gnus-group-set-mode-line)
(setq gnus-group-list-mode (cons level predicate))
(gnus-run-hooks 'gnus-group-prepare-hook)
t))