+(defun gnus-summary-gather-references (articles)
+ (and articles
+ (let ((tbuf (gnus-get-buffer-create " *gnus-summary-gather-references*"))
+ refs ref article i)
+ (save-excursion
+ (set-buffer tbuf)
+ (erase-buffer)
+ (while (setq article (pop articles))
+ (save-window-excursion
+ (set-buffer gnus-summary-buffer)
+ (gnus-summary-select-article nil nil nil article)
+ (gnus-summary-remove-process-mark article))
+ (gnus-copy-article-buffer)
+ (set-buffer gnus-article-copy)
+ (save-restriction
+ (message-narrow-to-head)
+ (setq refs (if articles
+ (concat (message-fetch-field "references")
+ (message-fetch-field "message-id"))
+ (message-fetch-field "references"))
+ i 0)
+ (widen)
+ (if refs
+ (progn (set-buffer tbuf)
+ (while (string-match "<[^>]+>" refs i)
+ (setq i (match-end 0)
+ ref (substring refs (match-beginning 0) i))
+ (goto-char (point-max))
+ (unless (search-backward ref (point-min) t)
+ (insert " " ref)))))))
+ (set-buffer tbuf)
+ (goto-char (point-min))
+ (if (looking-at "\\s +")
+ (goto-char (match-end 0)))
+ (buffer-substring (point) (point-max))))))
+