Function: gnus-summary-refer-thread

gnus-summary-refer-thread is an interactive and byte-compiled function defined in gnus-sum.el.gz.

Signature

(gnus-summary-refer-thread &optional LIMIT)

Documentation

Fetch all articles in the current thread.

For backends that know how to search for threads (currently only nnimap) a non-numeric prefix arg will search the entire server; without a prefix arg only the current group is searched. If the variable gnus-refer-thread-use-search is non-nil the prefix arg has the reverse meaning. If no backend-specific request-thread function is available fetch LIMIT (the numerical prefix) old headers. If LIMIT is non-numeric or nil fetch the number specified by the gnus-refer-thread-limit variable.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-sum.el.gz
(defun gnus-summary-refer-thread (&optional limit)
  "Fetch all articles in the current thread.
For backends that know how to search for threads (currently only
`nnimap') a non-numeric prefix arg will search the entire server;
without a prefix arg only the current group is searched.  If the
variable `gnus-refer-thread-use-search' is non-nil the prefix arg
has the reverse meaning.  If no backend-specific `request-thread'
function is available fetch LIMIT (the numerical prefix) old
headers.  If LIMIT is non-numeric or nil fetch the number
specified by the `gnus-refer-thread-limit' variable."
  (interactive "P" gnus-summary-mode)
  (let* ((header (gnus-summary-article-header))
	 (id (mail-header-id header))
	 (gnus-inhibit-demon t)
	 (gnus-summary-ignore-duplicates t)
	 (gnus-read-all-available-headers t)
	 (gnus-refer-thread-use-search
	  (if (and (not (null limit)) (listp limit))
	      (not gnus-refer-thread-use-search) gnus-refer-thread-use-search))
	 (new-headers
	  (if (gnus-check-backend-function
	       'request-thread gnus-newsgroup-name)
	      (gnus-request-thread header gnus-newsgroup-name)
	    (let* ((limit (if (numberp limit) (prefix-numeric-value limit)
			    gnus-refer-thread-limit))
		   (last (if (numberp limit)
			     (min (+ (mail-header-number header)
				     limit)
				  gnus-newsgroup-highest)
			   gnus-newsgroup-highest))
		   (subject (gnus-simplify-subject
			     (mail-header-subject header)))
		   (refs (split-string (or (mail-header-references header)
					   "")))
		   (gnus-parse-headers-hook
                    (let ((refs (append refs (list id subject))))
		      (lambda ()
                        (goto-char (point-min))
                        (keep-lines (regexp-opt refs))))))
	      (gnus-fetch-headers (list last) (if (numberp limit)
						  (* 2 limit) limit)
                                  t))))
	 article-ids new-unreads)
    (when (listp new-headers)
      (dolist (header new-headers)
	(push (mail-header-number header) article-ids))
      (setq article-ids (nreverse article-ids))
      (setq new-unreads
	    (gnus-sorted-intersection gnus-newsgroup-unselected article-ids))
      (setq gnus-newsgroup-unselected
	    (gnus-sorted-ndifference gnus-newsgroup-unselected new-unreads))
      (setq gnus-newsgroup-unreads
	    (gnus-sorted-nunion gnus-newsgroup-unreads new-unreads))
      (setq gnus-newsgroup-headers
            (gnus-delete-duplicate-headers
             (cl-merge
              'list gnus-newsgroup-headers new-headers
              'gnus-article-sort-by-number)))
      (setq gnus-newsgroup-articles
	    (gnus-sorted-nunion gnus-newsgroup-articles article-ids))
      (gnus-summary-limit-include-thread id gnus-refer-thread-limit-to-thread)))
  (gnus-summary-show-thread))