From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/73107 Path: news.gmane.org!not-for-mail From: Andrew Cohen Newsgroups: gmane.emacs.gnus.general Subject: Re: A T does not work in nnimap Date: Thu, 14 Oct 2010 08:57:03 -0400 Message-ID: <8762x5szj4.fsf@andy.bu.edu> References: <874ocrwjxu.fsf@andy.bu.edu> <87mxqjvuy8.fsf@andy.bu.edu> <87r5fuc6xk.fsf@andy.bu.edu> <87hbgpdd25.fsf@andy.bu.edu> <87d3rddbmu.fsf@andy.bu.edu> <87k4llfw24.fsf@andy.bu.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1287061119 11416 80.91.229.12 (14 Oct 2010 12:58:39 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 14 Oct 2010 12:58:39 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M21479@lists.math.uh.edu Thu Oct 14 14:58:38 2010 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1P6NOF-00083H-Je for ding-account@gmane.org; Thu, 14 Oct 2010 14:58:35 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1P6NN9-0007g4-Fj; Thu, 14 Oct 2010 07:57:27 -0500 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1P6NN6-0007fk-86 for ding@lists.math.uh.edu; Thu, 14 Oct 2010 07:57:24 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1P6NN4-00081o-Ew for ding@lists.math.uh.edu; Thu, 14 Oct 2010 07:57:23 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]) by quimby.gnus.org with esmtp (Exim 3.36 #1 (Debian)) id 1P6NN0-0000pg-00 for ; Thu, 14 Oct 2010 14:57:18 +0200 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1P6NMx-0007BA-Na for ding@gnus.org; Thu, 14 Oct 2010 14:57:15 +0200 Original-Received: from andy.bu.edu ([128.197.41.152]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 14 Oct 2010 14:57:15 +0200 Original-Received: from cohen by andy.bu.edu with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 14 Oct 2010 14:57:15 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 117 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: andy.bu.edu User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:lmhEqHWrlLwFrSZDoBtE1hKBmI0= X-Spam-Score: -1.9 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:73107 Archived-At: --=-=-= Content-Type: text/plain Sorry for so many followups, but here is a slightly improved version (more sensible signature for 'request-thread, and fixed a bug in buffer handling). Let me know if it works. Regards, Andy --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=refer.diff Content-Description: refer-thread changes diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el index 1086e28..de3ba50 100644 --- a/lisp/gnus-sum.el +++ b/lisp/gnus-sum.el @@ -8824,31 +8824,38 @@ Return the number of articles fetched." (defun gnus-summary-refer-thread (&optional limit) "Fetch all articles in the current thread. -If LIMIT (the numerical prefix), fetch that many old headers instead -of what's specified by the `gnus-refer-thread-limit' variable." +If no backend-specific 'request-thread function is available +fetch LIMIT (the numerical prefix) old headers. If LIMIT is nil +fetch what's specified by the `gnus-refer-thread-limit' +variable." (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)) + (gnus-command-method + (gnus-find-method-for-group gnus-newsgroup-name))) + (if (gnus-check-backend-function 'request-thread gnus-newsgroup-name) + (funcall (gnus-get-function gnus-command-method 'request-thread) + id) + (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 (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) + (gnus-message 5 "Fetching headers for %s...done" + gnus-newsgroup-name)))) + (when (eq gnus-headers-retrieved-by 'nov) + (gnus-build-all-threads)) (gnus-summary-limit-include-thread id))) (defun gnus-summary-refer-article (message-id) diff --git a/lisp/nnimap.el b/lisp/nnimap.el index 3fbcef6..9b338ff 100644 --- a/lisp/nnimap.el +++ b/lisp/nnimap.el @@ -1311,6 +1311,25 @@ textual parts.") (setq nnimap-status-string "Read-only server") nil) +(deffoo nnimap-request-thread (id) + (let* ((refs (split-string + (or (mail-header-references (gnus-summary-article-header)) + ""))) + (cmd (let ((value + (format + "(OR HEADER REFERENCES %s HEADER Message-Id %s)" + id id))) + (dolist (refid refs value) + (setq value (format + "(OR (OR HEADER Message-Id %s HEADER REFERENCES %s) %s)" + refid refid value))))) + (result + (with-current-buffer (nnimap-buffer) + (nnimap-command "UID SEARCH %s" cmd)))) + (gnus-fetch-headers (and (car result) + (delete 0 (mapcar #'string-to-number + (cdr (assoc "SEARCH" (cdr result))))))))) + (defun nnimap-possibly-change-group (group server) (let ((open-result t)) (when (and server --=-=-=--