aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/gnus/ChangeLog11
-rw-r--r--lisp/gnus/gnus-sum.el55
-rw-r--r--lisp/gnus/nnimap.el20
-rw-r--r--lisp/gnus/nnir.el11
4 files changed, 69 insertions, 28 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index a8065fc5ca4..400abd51c27 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,14 @@
12011-07-23 Andrew Cohen <cohen@andy.bu.edu>
2
3 * nnir.el (nnir-search-thread): New function to make an nnir group
4 based on a thread query.
5
6 * gnus-sum.el (gnus-refer-thread-use-nnir): New variable to control use
7 of nnir in thread referral.
8 (gnus-summary-refer-thread): Use it.
9
10 * nnimap.el (nnimap-request-thread): Use it.
11
12011-07-20 Lars Magne Ingebrigtsen <larsi@gnus.org> 122011-07-20 Lars Magne Ingebrigtsen <larsi@gnus.org>
2 13
3 * shr.el (shr-tag-comment): Ignore HTML comments. 14 * shr.el (shr-tag-comment): Ignore HTML comments.
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index 6e8fc63d79f..5917c9d7cef 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -118,6 +118,13 @@ If t, fetch all the available old headers."
118 :type '(choice number 118 :type '(choice number
119 (sexp :menu-tag "other" t))) 119 (sexp :menu-tag "other" t)))
120 120
121(defcustom gnus-refer-thread-use-nnir nil
122 "*Use nnir to search an entire server when referring threads. A
123nil value will only search for thread-related articles in the
124current group."
125 :group 'gnus-thread
126 :type 'boolean)
127
121(defcustom gnus-summary-make-false-root 'adopt 128(defcustom gnus-summary-make-false-root 'adopt
122 "*nil means that Gnus won't gather loose threads. 129 "*nil means that Gnus won't gather loose threads.
123If the root of a thread has expired or been read in a previous 130If the root of a thread has expired or been read in a previous
@@ -8972,11 +8979,16 @@ Return the number of articles fetched."
8972 result)) 8979 result))
8973 8980
8974(defun gnus-summary-refer-thread (&optional limit) 8981(defun gnus-summary-refer-thread (&optional limit)
8975 "Fetch all articles in the current thread. 8982 "Fetch all articles in the current thread. For backends that
8976If no backend-specific 'request-thread function is available 8983know how to search for threads (currently only 'nnimap) a
8977fetch LIMIT (the numerical prefix) old headers. If LIMIT is nil 8984non-numeric prefix arg will use nnir to search the entire
8978fetch what's specified by the `gnus-refer-thread-limit' 8985server; without a prefix arg only the current group is
8979variable." 8986searched. If the variable `gnus-refer-thread-use-nnir' is
8987non-nil the prefix arg has the reverse meaning. If no
8988backend-specific 'request-thread function is available fetch
8989LIMIT (the numerical prefix) old headers. If LIMIT is
8990non-numeric or nil fetch the number specified by the
8991`gnus-refer-thread-limit' variable."
8980 (interactive "P") 8992 (interactive "P")
8981 (gnus-warp-to-article) 8993 (gnus-warp-to-article)
8982 (let* ((header (gnus-summary-article-header)) 8994 (let* ((header (gnus-summary-article-header))
@@ -8984,13 +8996,16 @@ variable."
8984 (gnus-inhibit-demon t) 8996 (gnus-inhibit-demon t)
8985 (gnus-summary-ignore-duplicates t) 8997 (gnus-summary-ignore-duplicates t)
8986 (gnus-read-all-available-headers t) 8998 (gnus-read-all-available-headers t)
8987 (limit (if limit (prefix-numeric-value limit) 8999 (gnus-refer-thread-use-nnir
8988 gnus-refer-thread-limit)) 9000 (if (and (not (null limit)) (listp limit))
9001 (not gnus-refer-thread-use-nnir) gnus-refer-thread-use-nnir))
8989 (new-headers 9002 (new-headers
8990 (if (gnus-check-backend-function 9003 (if (gnus-check-backend-function
8991 'request-thread gnus-newsgroup-name) 9004 'request-thread gnus-newsgroup-name)
8992 (gnus-request-thread header gnus-newsgroup-name) 9005 (gnus-request-thread header gnus-newsgroup-name)
8993 (let* ((last (if (numberp limit) 9006 (let* ((limit (if (numberp limit) (prefix-numeric-value limit)
9007 gnus-refer-thread-limit))
9008 (last (if (numberp limit)
8994 (min (+ (mail-header-number header) 9009 (min (+ (mail-header-number header)
8995 limit) 9010 limit)
8996 gnus-newsgroup-highest) 9011 gnus-newsgroup-highest)
@@ -9005,17 +9020,19 @@ variable."
9005 (regexp-opt (append refs (list id subject))))))) 9020 (regexp-opt (append refs (list id subject)))))))
9006 (gnus-fetch-headers (list last) (if (numberp limit) 9021 (gnus-fetch-headers (list last) (if (numberp limit)
9007 (* 2 limit) limit) t))))) 9022 (* 2 limit) limit) t)))))
9008 (dolist (header new-headers) 9023 (when (listp new-headers)
9009 (when (member (mail-header-number header) gnus-newsgroup-unselected) 9024 (dolist (header new-headers)
9010 (push (mail-header-number header) gnus-newsgroup-unreads) 9025 (when (member (mail-header-number header) gnus-newsgroup-unselected)
9011 (setq gnus-newsgroup-unselected 9026 (push (mail-header-number header) gnus-newsgroup-unreads)
9012 (delete (mail-header-number header) gnus-newsgroup-unselected)))) 9027 (setq gnus-newsgroup-unselected
9013 (setq gnus-newsgroup-headers 9028 (delete (mail-header-number header)
9014 (gnus-delete-duplicate-headers 9029 gnus-newsgroup-unselected))))
9015 (gnus-merge 9030 (setq gnus-newsgroup-headers
9016 'list gnus-newsgroup-headers new-headers 9031 (gnus-delete-duplicate-headers
9017 'gnus-article-sort-by-number))) 9032 (gnus-merge
9018 (gnus-summary-limit-include-thread id))) 9033 'list gnus-newsgroup-headers new-headers
9034 'gnus-article-sort-by-number)))
9035 (gnus-summary-limit-include-thread id))))
9019 9036
9020(defun gnus-summary-refer-article (message-id) 9037(defun gnus-summary-refer-article (message-id)
9021 "Fetch an article specified by MESSAGE-ID." 9038 "Fetch an article specified by MESSAGE-ID."
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index 385522759b6..8a0d635ef7b 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -1566,15 +1566,17 @@ textual parts.")
1566 (articles &optional limit force-new dependencies)) 1566 (articles &optional limit force-new dependencies))
1567 1567
1568(deffoo nnimap-request-thread (header &optional group server) 1568(deffoo nnimap-request-thread (header &optional group server)
1569 (when (nnimap-possibly-change-group group server) 1569 (if gnus-refer-thread-use-nnir
1570 (let* ((cmd (nnimap-make-thread-query header)) 1570 (nnir-search-thread header)
1571 (result (with-current-buffer (nnimap-buffer) 1571 (when (nnimap-possibly-change-group group server)
1572 (nnimap-command "UID SEARCH %s" cmd)))) 1572 (let* ((cmd (nnimap-make-thread-query header))
1573 (when result 1573 (result (with-current-buffer (nnimap-buffer)
1574 (gnus-fetch-headers 1574 (nnimap-command "UID SEARCH %s" cmd))))
1575 (and (car result) (delete 0 (mapcar #'string-to-number 1575 (when result
1576 (cdr (assoc "SEARCH" (cdr result)))))) 1576 (gnus-fetch-headers
1577 nil t))))) 1577 (and (car result) (delete 0 (mapcar #'string-to-number
1578 (cdr (assoc "SEARCH" (cdr result))))))
1579 nil t))))))
1578 1580
1579(defun nnimap-possibly-change-group (group server) 1581(defun nnimap-possibly-change-group (group server)
1580 (let ((open-result t)) 1582 (let ((open-result t))
diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el
index 9840dddcb66..e6420a4d7bb 100644
--- a/lisp/gnus/nnir.el
+++ b/lisp/gnus/nnir.el
@@ -289,6 +289,7 @@ is `(valuefunc member)'."
289 (autoload 'nnimap-buffer "nnimap") 289 (autoload 'nnimap-buffer "nnimap")
290 (autoload 'nnimap-command "nnimap") 290 (autoload 'nnimap-command "nnimap")
291 (autoload 'nnimap-possibly-change-group "nnimap") 291 (autoload 'nnimap-possibly-change-group "nnimap")
292 (autoload 'nnimap-make-thread-query "nnimap")
292 (autoload 'gnus-registry-action "gnus-registry") 293 (autoload 'gnus-registry-action "gnus-registry")
293 (defvar gnus-registry-install)) 294 (defvar gnus-registry-install))
294 295
@@ -1649,6 +1650,16 @@ server is of form 'backend:name'."
1649 (nnir-open-server server))) 1650 (nnir-open-server server)))
1650 1651
1651 1652
1653(defun nnir-search-thread (header)
1654 "Make an nnir group based on the thread containing the article header"
1655 (let ((parm (list
1656 (cons 'query
1657 (nnimap-make-thread-query header))
1658 (cons 'criteria "")
1659 (cons 'server (gnus-method-to-server
1660 (gnus-find-method-for-group
1661 gnus-newsgroup-name))))))
1662 (gnus-group-make-nnir-group nil parm)))
1652 1663
1653;; unused? 1664;; unused?
1654(defun nnir-artlist-groups (artlist) 1665(defun nnir-artlist-groups (artlist)