Function: gnus-rebuild-thread
gnus-rebuild-thread is a byte-compiled function defined in
gnus-sum.el.gz.
Signature
(gnus-rebuild-thread ID &optional LINE)
Documentation
Rebuild the thread containing ID.
If LINE, insert the rebuilt thread starting on line LINE.
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/gnus-sum.el.gz
(defun gnus-rebuild-thread (id &optional line)
"Rebuild the thread containing ID.
If LINE, insert the rebuilt thread starting on line LINE."
(let ((inhibit-read-only t)
old-pos current thread data)
(if (not gnus-show-threads)
(setq thread (list (car (gnus-id-to-thread id))))
;; Get the thread this article is part of.
(setq thread (gnus-remove-thread id)))
(setq old-pos (line-beginning-position))
(setq current (save-excursion
(and (re-search-backward "[\r\n]" nil t)
(gnus-summary-article-number))))
;; If this is a gathered thread, we have to go some re-gathering.
(when (stringp (car thread))
(let ((subject (car thread))
roots thr)
(setq thread (cdr thread))
(while thread
(unless (memq (setq thr (gnus-id-to-thread
(gnus-root-id
(mail-header-id (caar thread)))))
roots)
(push thr roots))
(setq thread (cdr thread)))
;; We now have all (unique) roots.
(setq thread (if (= (length roots) 1)
;; All the loose roots are now one solid root.
(car roots)
(cons subject (gnus-sort-threads roots))))))
(let (threads)
;; We then insert this thread into the summary buffer.
(when line
(goto-char (point-min))
(forward-line (1- line)))
(let (gnus-newsgroup-data gnus-newsgroup-threads)
(if gnus-show-threads
(gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
(gnus-summary-prepare-unthreaded thread))
;; FIXME: Why is this `nreverse' safe? Don't we need `reverse' instead?
(setq data (nreverse gnus-newsgroup-data))
(setq threads gnus-newsgroup-threads))
;; We splice the new data into the data structure.
;;!!! This is kinda bogus. We assume that in LINE is non-nil,
;;!!! then we want to insert at the beginning of the buffer.
;;!!! That happens to be true with Gnus now, but that may
;;!!! change in the future. Perhaps.
(gnus-data-enter-list
(if line nil current) data (- (point) old-pos))
(setq gnus-newsgroup-threads
(nconc threads gnus-newsgroup-threads))
(gnus-data-compute-positions))))