Function: gnus-topic-find-groups

gnus-topic-find-groups is an autoloaded and byte-compiled function defined in gnus-topic.el.gz.

Signature

(gnus-topic-find-groups TOPIC &optional LEVEL ALL LOWEST RECURSIVE)

Documentation

Return entries for all visible groups in TOPIC.

If RECURSIVE is t, return groups in its subtopics too.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-topic.el.gz
(defun gnus-topic-find-groups (topic &optional level all lowest recursive)
  "Return entries for all visible groups in TOPIC.
If RECURSIVE is t, return groups in its subtopics too."
  (let ((groups (cdr (assoc topic gnus-topic-alist)))
	info clevel unread group params visible-groups entry active)
    (setq lowest (or lowest 1))
    (setq level (or level gnus-level-unsubscribed))
    ;; We go through the newsrc to look for matches.
    (while groups
      (when (setq group (pop groups))
	(setq entry (gnus-group-entry group)
	      info (nth 1 entry)
	      params (gnus-info-params info)
	      active (gnus-active group)
	      unread (or (car entry)
			 (and (not (equal group "dummy.group"))
			      active
			      (- (1+ (cdr active)) (car active))))
	      clevel (or (gnus-info-level info)
			 (if (member group gnus-zombie-list)
			     gnus-level-zombie gnus-level-killed))))
      (and
       info				; nil means that the group is dead.
       (<= clevel level)
       (>= clevel lowest)		; Is inside the level we want.
       (or all
	   (if (or (eq unread t)
		   (eq unread nil))
	       gnus-group-list-inactive-groups
	     (> unread 0))
	   (and gnus-list-groups-with-ticked-articles
		(cdr (assq 'tick (gnus-info-marks info))))
	   ;; Has right readedness.
	   ;; 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)))
       ;; Add this group to the list of visible groups.
       (push (or entry group) visible-groups)))
    (setq visible-groups (nreverse visible-groups))
    (when recursive
      (if (eq recursive t)
	  (setq recursive (cdr (gnus-topic-find-topology topic))))
      (dolist (topic-topology (cdr recursive))
	(setq visible-groups
	      (nconc visible-groups
		     (gnus-topic-find-groups
		      (caar topic-topology)
		      level all lowest topic-topology)))))
    visible-groups))