--- a/gnus-sum.el 2010-09-26 14:53:35.000000000 -0400 +++ b/gnus-sum.el 2010-09-26 14:55:49.000000000 -0400 @@ -8826,26 +8826,38 @@ (interactive "P") (let ((id (mail-header-id (gnus-summary-article-header))) (limit (if limit (prefix-numeric-value limit) - gnus-refer-thread-limit))) - (unless (eq gnus-fetch-old-headers 'invisible) - (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name) - ;; Retrieve the headers and read them in. - (if (eq (if (numberp limit) - (gnus-retrieve-headers - (list (min - (+ (mail-header-number - (gnus-summary-article-header)) - limit) - gnus-newsgroup-end)) - gnus-newsgroup-name (* limit 2)) - ;; gnus-refer-thread-limit is t, i.e. fetch _all_ - ;; headers. - (gnus-retrieve-headers (list gnus-newsgroup-end) - gnus-newsgroup-name limit)) - 'nov) - (gnus-build-all-threads) - (error "Can't fetch thread from back ends that don't support NOV")) - (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)) + gnus-refer-thread-limit)) + (subject (mail-header-subject (gnus-summary-article-header))) + (group (if (string-match "-ephemeral" gnus-newsgroup-name) + (replace-match "" nil t gnus-newsgroup-name) + gnus-newsgroup-name))) + (if (string= (car (gnus-group-method group)) "nnimap") + (with-current-buffer (nnimap-buffer) + (let ((result (nnimap-command + "UID SEARCH OR HEADER REFERENCES %S HEADER Message-Id %S" id id))) + (gnus-summary-read-group-1 group t t nil nil + (and (car result) + (delete 0 (mapcar #'string-to-number + (cdr (assoc "SEARCH" (cdr result))))))))) + (unless (eq gnus-fetch-old-headers 'invisible) + (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name) + ;; Retrieve the headers and read them in. + (if (eq (if (numberp limit) + (gnus-retrieve-headers + (list (min + (+ (mail-header-number + (gnus-summary-article-header)) + limit) + gnus-newsgroup-end)) + gnus-newsgroup-name (* limit 2)) + ;; gnus-refer-thread-limit is t, i.e. fetch _all_ + ;; headers. + (gnus-retrieve-headers (list gnus-newsgroup-end) + gnus-newsgroup-name limit)) + 'nov) + (gnus-build-all-threads) + (error "Can't fetch thread from back ends that don't support NOV")) + (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))) (gnus-summary-limit-include-thread id))) (defun gnus-summary-refer-article (message-id)