Function: gnus-remove-thread
gnus-remove-thread is a byte-compiled function defined in
gnus-sum.el.gz.
Signature
(gnus-remove-thread ID &optional DONT-REMOVE)
Documentation
Remove the thread that has ID in it.
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/gnus-sum.el.gz
(defun gnus-remove-thread (id &optional dont-remove)
"Remove the thread that has ID in it."
(let (headers thread last-id)
;; First go up in this thread until we find the root.
(setq last-id (gnus-root-id id)
headers (flatten-tree (gnus-id-to-thread last-id)))
;; We have now found the real root of this thread. It might have
;; been gathered into some loose thread, so we have to search
;; through the threads to find the thread we wanted.
(let ((threads gnus-newsgroup-threads)
sub)
(while threads
(setq sub (car threads))
(if (stringp (car sub))
;; This is a gathered thread, so we look at the roots
;; below it to find whether this article is in this
;; gathered root.
(progn
(setq sub (cdr sub))
(while sub
(when (member (caar sub) headers)
(setq thread (car threads)
threads nil
sub nil))
(setq sub (cdr sub))))
;; It's an ordinary thread, so we check it.
(when (eq (car sub) (car headers))
(setq thread sub
threads nil)))
(setq threads (cdr threads)))
;; If this article is in no thread, then it's a root.
(if thread
(unless dont-remove
(setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
(setq thread (gnus-id-to-thread last-id)))
(when thread
(prog1
thread ; We return this thread.
(unless dont-remove
(if (stringp (car thread))
(progn
;; If we use dummy roots, then we have to remove the
;; dummy root as well.
(when (eq gnus-summary-make-false-root 'dummy)
;; We go to the dummy root by going to
;; the first sub-"thread", and then one line up.
(gnus-summary-goto-article
(mail-header-number (caadr thread)))
(forward-line -1)
(gnus-delete-line)
(gnus-data-compute-positions))
(setq thread (cdr thread))
(while thread
(gnus-remove-thread-1 (car thread))
(setq thread (cdr thread))))
(gnus-remove-thread-1 thread))))))))