Function: gnus-gather-threads-by-subject

gnus-gather-threads-by-subject is a byte-compiled function defined in gnus-sum.el.gz.

Signature

(gnus-gather-threads-by-subject THREADS)

Documentation

Gather threads by looking at Subject headers.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-sum.el.gz
(defun gnus-gather-threads-by-subject (threads)
  "Gather threads by looking at Subject headers."
  (if (not gnus-summary-make-false-root)
      threads
    (let ((hashtb (gnus-make-hashtable 1000))
	  (prev threads)
	  (result threads)
	  subject hthread whole-subject)
      (while threads
	(setq subject (gnus-general-simplify-subject
		       (setq whole-subject (mail-header-subject
					    (caar threads)))))
	(when subject
	  (if (setq hthread (gethash subject hashtb))
	      (progn
		;; We enter a dummy root into the thread, if we
		;; haven't done that already.
		(unless (stringp (caar hthread))
		  (setcar hthread (list whole-subject (car hthread))))
		;; We add this new gathered thread to this gathered
		;; thread.
		(setcdr (car hthread)
			(nconc (cdar hthread) (list (car threads))))
		;; Remove it from the list of threads.
		(setcdr prev (cdr threads))
		(setq threads prev))
	    ;; Enter this thread into the hash table.
	    (puthash subject
		     (if gnus-summary-make-false-root-always
			 (progn
			   ;; If you want a dummy root above all
			   ;; threads...
			   (setcar threads (list whole-subject
						 (car threads)))
			   threads)
		       threads)
		     hashtb)))
	(setq prev threads)
	(setq threads (cdr threads)))
      result)))