Function: gnus-group-prepare-topics

gnus-group-prepare-topics is a byte-compiled function defined in gnus-topic.el.gz.

Signature

(gnus-group-prepare-topics LEVEL &optional PREDICATE LOWEST REGEXP LIST-TOPIC TOPIC-LEVEL)

Documentation

List all newsgroups with unread articles of level LEVEL or lower.

Use the gnus-group-topics to sort the groups. 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.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-topic.el.gz
;;; Generating group buffers

(defun gnus-group-prepare-topics (level &optional predicate lowest
					regexp list-topic topic-level)
  "List all newsgroups with unread articles of level LEVEL or lower.
Use the `gnus-group-topics' to sort the groups.
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."
  (set-buffer gnus-group-buffer)
  (let ((inhibit-read-only t)
	(lowest (or lowest 1))
	(not-in-list
	 (and gnus-group-listed-groups
	      (copy-sequence gnus-group-listed-groups))))

    (gnus-update-format-specifications nil 'topic)

    (when (or (not gnus-topic-alist)
	      (not gnus-topology-checked-p))
      (gnus-topic-check-topology))

    (unless list-topic
      (erase-buffer))

    ;; 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 (or gnus-group-listed-groups
	       (and (>= level gnus-level-killed)
		    (<= lowest gnus-level-killed)))
      (gnus-group-prepare-flat-list-dead
       (setq gnus-killed-list (sort gnus-killed-list #'string<))
       gnus-level-killed ?K regexp)
      (when not-in-list
	(unless gnus-killed-hashtb
	  (gnus-make-hashtable-from-killed))
	(gnus-group-prepare-flat-list-dead
	 (seq-remove (lambda (group)
			   (or (gnus-group-entry group)
			       (gethash group gnus-killed-hashtb)))
			 not-in-list)
	 gnus-level-killed ?K regexp)))

    ;; Use topics.
    (prog1
	(when (or (< lowest gnus-level-zombie)
		  gnus-group-listed-groups)
	  (if list-topic
	      (let ((top (gnus-topic-find-topology list-topic)))
		(gnus-topic-prepare-topic (cdr top) (car top)
					  (or topic-level level) predicate
					  nil lowest regexp))
	    (gnus-topic-prepare-topic gnus-topic-topology 0
				      (or topic-level level) predicate
				      nil lowest regexp)))
      (gnus-group-set-mode-line)
      (setq gnus-group-list-mode (cons level predicate))
      (gnus-run-hooks 'gnus-group-prepare-hook))))