Function: gnus-thread-loop-p

gnus-thread-loop-p is a byte-compiled function defined in gnus-sum.el.gz.

Signature

(gnus-thread-loop-p ROOT THREAD)

Documentation

Say whether ROOT is in THREAD.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-sum.el.gz
(defun gnus-thread-loop-p (root thread)
  "Say whether ROOT is in THREAD."
  (let ((stack (list thread))
	(infloop 0)
	th)
    (while (setq thread (pop stack))
      (setq th (cdr thread))
      (while (and th
		  (not (eq (caar th) root)))
	(pop th))
      (if th
	  ;; We have found a loop.
	  (let (ref-dep)
	    (setcdr thread (delq (car th) (cdr thread)))
	    (if (setq ref-dep (gethash "none"
				       gnus-newsgroup-dependencies))
		(setcdr ref-dep
			(nconc (cdr ref-dep)
			       (list (car th))))
	      (puthash ref-dep (list nil (car th)) gnus-newsgroup-dependencies))
	    (setq infloop 1
		  stack nil))
	;; Push all the subthreads onto the stack.
	(push (cdr thread) stack)))
    infloop))