Function: gnus-topic-update-topic-line

gnus-topic-update-topic-line is a byte-compiled function defined in gnus-topic.el.gz.

Signature

(gnus-topic-update-topic-line TOPIC-NAME &optional READS)

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-topic.el.gz
(defun gnus-topic-update-topic-line (topic-name &optional reads)
  (let* ((top (gnus-topic-find-topology topic-name))
	 (type (cadr top))
	 (children (cddr top))
	 (entries (gnus-topic-find-groups
		   (car type) (car gnus-group-list-mode)
		   (cdr gnus-group-list-mode)))
	 (all-groups (gnus-topic-find-groups
		      (car type) (car gnus-group-list-mode)
		      (cdr gnus-group-list-mode) nil t))
	 (parent (gnus-topic-parent-topic topic-name))
	 (all-entries entries)
	 (unread 0)
	 old-unread entry new-unread)
    (when (gnus-topic-goto-topic (car type))
      ;; Tally all the groups that belong in this topic.
      (if reads
	  (setq unread (- (gnus-group-topic-unread) reads))
	(while children
          (incf unread (gnus-topic-unread (caar (pop children)))))
	(while (setq entry (pop entries))
	  (when (numberp (car entry))
            (incf unread (car entry)))))
      (setq old-unread (gnus-group-topic-unread))
      ;; Insert the topic line.
      (gnus-topic-insert-topic-line
       (car type) (gnus-topic-visible-p)
       (not (eq (nth 2 type) 'hidden))
       (gnus-group-topic-level) all-entries unread all-groups)
      (gnus-delete-line)
      (forward-line -1)
      (setq new-unread (gnus-group-topic-unread)))
    (when parent
      (forward-line -1)
      (gnus-topic-update-topic-line
       parent
       (- (or old-unread 0) (or new-unread 0))))
    unread))