aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGnus developers2010-11-07 00:22:06 +0000
committerKatsumi Yamaoka2010-11-07 00:22:06 +0000
commit4ddab346e6595eefaaf575a1aee508950a33fee0 (patch)
treec1c593fbad1d2a5905a537a29445b6d6832a1a97
parent5ed619e0a309c8ce539f0fbc2d19a068139f099d (diff)
downloademacs-4ddab346e6595eefaaf575a1aee508950a33fee0.tar.gz
emacs-4ddab346e6595eefaaf575a1aee508950a33fee0.zip
gnus-int.el, nnimap.el, nnir.el: More improvements to thread-referral.
message.el (message-send-mail): Don't insert courtesy messages if the message already has List-Post and List-ID messages. gnus-ems.el (gnus-put-image): Use a blank text as the insertion string to avoid making the From headers syntactically invalid.
-rw-r--r--lisp/gnus/ChangeLog23
-rw-r--r--lisp/gnus/gnus-ems.el2
-rw-r--r--lisp/gnus/gnus-int.el13
-rw-r--r--lisp/gnus/gnus-sum.el85
-rw-r--r--lisp/gnus/message.el2
-rw-r--r--lisp/gnus/nnimap.el34
-rw-r--r--lisp/gnus/nnir.el64
7 files changed, 106 insertions, 117 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index d287b07569c..5b2c0bb1e64 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,9 +1,32 @@
12010-11-06 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * gnus-ems.el (gnus-put-image): Use a blank text as the insertion
4 string to avoid making the From headers syntactically invalid.
5
6 * message.el (message-send-mail): Don't insert courtesy messages if the
7 message already has List-Post and List-ID messages.
8
12010-11-06 Glenn Morris <rgm@gnu.org> 92010-11-06 Glenn Morris <rgm@gnu.org>
2 10
3 * gnus-art.el (gnus-treat-article): Give dynamic local variables 11 * gnus-art.el (gnus-treat-article): Give dynamic local variables
4 `condition', `type', `length' a prefix. 12 `condition', `type', `length' a prefix.
5 (gnus-treat-predicate): Update for above name changes. 13 (gnus-treat-predicate): Update for above name changes.
6 14
152010-11-06 Andrew Cohen <cohen@andy.bu.edu>
16
17 * nnir.el (gnus-summary-nnir-goto-thread): Remove function and
18 binding. Handled by `gnus-summary-refer-thread' instead.
19 (nnir-warp-to-article): New backend function.
20
21 * nnimap.el (nnimap-request-thread): Force dependency updating.
22
23 * gnus-sum.el (gnus-fetch-headers): Allow more arguments.
24 (gnus-summary-refer-thread): Rework to improve thread-referral.
25
26 * gnus-int.el (gnus-warp-to-article): New function.
27
28 * gnus-sum.el (gnus-summary-article-map): Bind it.
29
72010-11-04 Andrew Cohen <cohen@andy.bu.edu> 302010-11-04 Andrew Cohen <cohen@andy.bu.edu>
8 31
9 * nnir.el (gnus-summary-nnir-goto-thread): Limit work done by 32 * nnir.el (gnus-summary-nnir-goto-thread): Limit work done by
diff --git a/lisp/gnus/gnus-ems.el b/lisp/gnus/gnus-ems.el
index 3a79e67801f..d7d90767124 100644
--- a/lisp/gnus/gnus-ems.el
+++ b/lisp/gnus/gnus-ems.el
@@ -181,7 +181,7 @@
181 181
182(defun gnus-put-image (glyph &optional string category) 182(defun gnus-put-image (glyph &optional string category)
183 (let ((point (point))) 183 (let ((point (point)))
184 (insert-image glyph (or string "*")) 184 (insert-image glyph (or string " "))
185 (put-text-property point (point) 'gnus-image-category category) 185 (put-text-property point (point) 'gnus-image-category category)
186 (unless string 186 (unless string
187 (put-text-property (1- (point)) (point) 187 (put-text-property (1- (point)) (point)
diff --git a/lisp/gnus/gnus-int.el b/lisp/gnus/gnus-int.el
index b344a5ef15c..bcfff347968 100644
--- a/lisp/gnus/gnus-int.el
+++ b/lisp/gnus/gnus-int.el
@@ -503,11 +503,22 @@ If BUFFER, insert the article in that group."
503 (nth 1 gnus-command-method) buffer))) 503 (nth 1 gnus-command-method) buffer)))
504 504
505(defun gnus-request-thread (id) 505(defun gnus-request-thread (id)
506 "Request the thread containing the article specified by Message-ID id." 506 "Request the headers in the thread containing the article
507specified by Message-ID id."
507 (let ((gnus-command-method (gnus-find-method-for-group gnus-newsgroup-name))) 508 (let ((gnus-command-method (gnus-find-method-for-group gnus-newsgroup-name)))
508 (funcall (gnus-get-function gnus-command-method 'request-thread) 509 (funcall (gnus-get-function gnus-command-method 'request-thread)
509 id))) 510 id)))
510 511
512(defun gnus-warp-to-article ()
513 "Warps from an article in a virtual group to the article in its
514real group. Does nothing on a real group."
515 (interactive)
516 (let ((gnus-command-method
517 (gnus-find-method-for-group gnus-newsgroup-name)))
518 (when (gnus-check-backend-function
519 'warp-to-article (car gnus-command-method))
520 (funcall (gnus-get-function gnus-command-method 'warp-to-article)))))
521
511(defun gnus-request-head (article group) 522(defun gnus-request-head (article group)
512 "Request the head of ARTICLE in GROUP." 523 "Request the head of ARTICLE in GROUP."
513 (let* ((gnus-command-method (gnus-find-method-for-group group)) 524 (let* ((gnus-command-method (gnus-find-method-for-group group))
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index 2eedc07d10f..ad2f5b6d9c6 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -2061,6 +2061,7 @@ increase the score of each group you read."
2061 "D" gnus-summary-enter-digest-group 2061 "D" gnus-summary-enter-digest-group
2062 "R" gnus-summary-refer-references 2062 "R" gnus-summary-refer-references
2063 "T" gnus-summary-refer-thread 2063 "T" gnus-summary-refer-thread
2064 "W" gnus-warp-to-article
2064 "g" gnus-summary-show-article 2065 "g" gnus-summary-show-article
2065 "s" gnus-summary-isearch-article 2066 "s" gnus-summary-isearch-article
2066 "P" gnus-summary-print-article 2067 "P" gnus-summary-print-article
@@ -5468,7 +5469,7 @@ or a straight list of headers."
5468 (substring subject (match-end 1))))) 5469 (substring subject (match-end 1)))))
5469 (mail-header-set-subject header subject)))))) 5470 (mail-header-set-subject header subject))))))
5470 5471
5471(defun gnus-fetch-headers (articles) 5472(defun gnus-fetch-headers (articles &optional limit force-new dependencies)
5472 "Fetch headers of ARTICLES." 5473 "Fetch headers of ARTICLES."
5473 (let ((name (gnus-group-decoded-name gnus-newsgroup-name))) 5474 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
5474 (gnus-message 5 "Fetching headers for %s..." name) 5475 (gnus-message 5 "Fetching headers for %s..." name)
@@ -5477,16 +5478,17 @@ or a straight list of headers."
5477 (setq gnus-headers-retrieved-by 5478 (setq gnus-headers-retrieved-by
5478 (gnus-retrieve-headers 5479 (gnus-retrieve-headers
5479 articles gnus-newsgroup-name 5480 articles gnus-newsgroup-name
5480 ;; We might want to fetch old headers, but 5481 (or limit
5481 ;; not if there is only 1 article. 5482 ;; We might want to fetch old headers, but
5482 (and (or (and 5483 ;; not if there is only 1 article.
5483 (not (eq gnus-fetch-old-headers 'some)) 5484 (and (or (and
5484 (not (numberp gnus-fetch-old-headers))) 5485 (not (eq gnus-fetch-old-headers 'some))
5485 (> (length articles) 1)) 5486 (not (numberp gnus-fetch-old-headers)))
5486 gnus-fetch-old-headers)))) 5487 (> (length articles) 1))
5488 gnus-fetch-old-headers)))))
5487 (gnus-get-newsgroup-headers-xover 5489 (gnus-get-newsgroup-headers-xover
5488 articles nil nil gnus-newsgroup-name t) 5490 articles force-new dependencies gnus-newsgroup-name t)
5489 (gnus-get-newsgroup-headers)) 5491 (gnus-get-newsgroup-headers dependencies force-new))
5490 (gnus-message 5 "Fetching headers for %s...done" name)))) 5492 (gnus-message 5 "Fetching headers for %s...done" name))))
5491 5493
5492(defun gnus-select-newsgroup (group &optional read-all select-articles) 5494(defun gnus-select-newsgroup (group &optional read-all select-articles)
@@ -8835,46 +8837,39 @@ fetch LIMIT (the numerical prefix) old headers. If LIMIT is nil
8835fetch what's specified by the `gnus-refer-thread-limit' 8837fetch what's specified by the `gnus-refer-thread-limit'
8836variable." 8838variable."
8837 (interactive "P") 8839 (interactive "P")
8840 (gnus-warp-to-article)
8838 (let ((id (mail-header-id (gnus-summary-article-header))) 8841 (let ((id (mail-header-id (gnus-summary-article-header)))
8839 (subject (gnus-simplify-subject
8840 (mail-header-subject (gnus-summary-article-header))))
8841 (refs (split-string (or (mail-header-references
8842 (gnus-summary-article-header)) "")))
8843 (gnus-summary-ignore-duplicates t)
8844 (gnus-inhibit-demon t) 8842 (gnus-inhibit-demon t)
8843 (gnus-agent nil)
8844 (gnus-summary-ignore-duplicates t)
8845 (gnus-read-all-available-headers t) 8845 (gnus-read-all-available-headers t)
8846 (limit (if limit (prefix-numeric-value limit) 8846 (limit (if limit (prefix-numeric-value limit)
8847 gnus-refer-thread-limit))) 8847 gnus-refer-thread-limit)))
8848 (if (gnus-check-backend-function 'request-thread gnus-newsgroup-name) 8848 (setq gnus-newsgroup-headers
8849 (setq gnus-newsgroup-headers 8849 (gnus-merge
8850 (gnus-merge 'list 8850 'list gnus-newsgroup-headers
8851 gnus-newsgroup-headers 8851 (if (gnus-check-backend-function
8852 (gnus-request-thread id) 8852 'request-thread gnus-newsgroup-name)
8853 'gnus-article-sort-by-number)) 8853 (gnus-request-thread id)
8854 (unless (eq gnus-fetch-old-headers 'invisible) 8854 (let* ((last (if (numberp limit)
8855 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name) 8855 (min (+ (mail-header-number
8856 ;; Retrieve the headers and read them in. 8856 (gnus-summary-article-header))
8857 (if (numberp limit) 8857 limit)
8858 (gnus-retrieve-headers 8858 gnus-newsgroup-highest)
8859 (list (min 8859 gnus-newsgroup-highest))
8860 (+ (mail-header-number 8860 (subject (gnus-simplify-subject
8861 (gnus-summary-article-header)) 8861 (mail-header-subject
8862 limit) 8862 (gnus-summary-article-header))))
8863 gnus-newsgroup-end)) 8863 (refs (split-string (or (mail-header-references
8864 gnus-newsgroup-name (* limit 2)) 8864 (gnus-summary-article-header))
8865 ;; gnus-refer-thread-limit is t, i.e. fetch _all_ 8865 "")))
8866 ;; headers. 8866 (gnus-parse-headers-hook
8867 (gnus-retrieve-headers (list gnus-newsgroup-end) 8867 (lambda () (goto-char (point-min))
8868 gnus-newsgroup-name limit) 8868 (keep-lines
8869 (gnus-message 5 "Fetching headers for %s...done" 8869 (regexp-opt (append refs (list id subject)))))))
8870 gnus-newsgroup-name)))) 8870 (gnus-fetch-headers (list last) (if (numberp limit)
8871 (when (eq gnus-headers-retrieved-by 'nov) 8871 (* 2 limit) limit) t)))
8872 ;; might as well restrict the headers to the relevant ones. this 8872 'gnus-article-sort-by-number))
8873 ;; should save time when building threads.
8874 (with-current-buffer nntp-server-buffer
8875 (goto-char (point-min))
8876 (keep-lines (regexp-opt (append refs (list id subject)))))
8877 (gnus-build-all-threads))
8878 (gnus-summary-limit-include-thread id))) 8873 (gnus-summary-limit-include-thread id)))
8879 8874
8880(defun gnus-summary-refer-article (message-id) 8875(defun gnus-summary-refer-article (message-id)
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index cc793dfcf9a..722ef430298 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -4482,6 +4482,8 @@ This function could be useful in `message-setup-hook'."
4482 (save-restriction 4482 (save-restriction
4483 (message-narrow-to-headers) 4483 (message-narrow-to-headers)
4484 (and news 4484 (and news
4485 (not (message-fetch-field "List-Post"))
4486 (not (message-fetch-field "List-ID"))
4485 (or (message-fetch-field "cc") 4487 (or (message-fetch-field "cc")
4486 (message-fetch-field "bcc") 4488 (message-fetch-field "bcc")
4487 (message-fetch-field "to")) 4489 (message-fetch-field "to"))
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index 65d5af964e5..67e2c91c3a2 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -1397,23 +1397,23 @@ textual parts.")
1397 nil) 1397 nil)
1398 1398
1399(deffoo nnimap-request-thread (id) 1399(deffoo nnimap-request-thread (id)
1400 (let* ((refs (split-string 1400 (let* ((refs (split-string
1401 (or (mail-header-references (gnus-summary-article-header)) 1401 (or (mail-header-references (gnus-summary-article-header))
1402 ""))) 1402 "")))
1403 (cmd (let ((value 1403 (cmd (let ((value
1404 (format 1404 (format
1405 "(OR HEADER REFERENCES %s HEADER Message-Id %s)" 1405 "(OR HEADER REFERENCES %s HEADER Message-Id %s)"
1406 id id))) 1406 id id)))
1407 (dolist (refid refs value) 1407 (dolist (refid refs value)
1408 (setq value (format 1408 (setq value (format
1409 "(OR (OR HEADER Message-Id %s HEADER REFERENCES %s) %s)" 1409 "(OR (OR HEADER Message-Id %s HEADER REFERENCES %s) %s)"
1410 refid refid value))))) 1410 refid refid value)))))
1411 (result 1411 (result (with-current-buffer (nnimap-buffer)
1412 (with-current-buffer (nnimap-buffer) 1412 (nnimap-command "UID SEARCH %s" cmd))))
1413 (nnimap-command "UID SEARCH %s" cmd)))) 1413 (gnus-fetch-headers
1414 (gnus-fetch-headers (and (car result) 1414 (and (car result) (delete 0 (mapcar #'string-to-number
1415 (delete 0 (mapcar #'string-to-number 1415 (cdr (assoc "SEARCH" (cdr result))))))
1416 (cdr (assoc "SEARCH" (cdr result))))))))) 1416 nil t)))
1417 1417
1418(defun nnimap-possibly-change-group (group server) 1418(defun nnimap-possibly-change-group (group server)
1419 (let ((open-result t)) 1419 (let ((open-result t))
diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el
index 326de6e3ac8..ae6b903c047 100644
--- a/lisp/gnus/nnir.el
+++ b/lisp/gnus/nnir.el
@@ -41,9 +41,10 @@
41;; Retrieval Status Value (score). 41;; Retrieval Status Value (score).
42 42
43;; When looking at the retrieval result (in the Summary buffer) you 43;; When looking at the retrieval result (in the Summary buffer) you
44;; can type `G T' (aka M-x gnus-summary-nnir-goto-thread RET) on an 44;; can type `A W' (aka M-x gnus-warp-article RET) on an article. You
45;; article. You will be teleported into the group this article came 45;; will be warped into the group this article came from. Typing `A W'
46;; from, showing the thread this article is part of. 46;; (aka M-x gnus-summary-refer-thread RET) will warp to the group and
47;; also show the thread this article is part of.
47 48
48;; The Lisp setup may involve setting a few variables and setting up the 49;; The Lisp setup may involve setting a few variables and setting up the
49;; search engine. You can define the variables in the server definition 50;; search engine. You can define the variables in the server definition
@@ -473,56 +474,6 @@ result, `gnus-retrieve-headers' will be called instead.")
473 (cons (current-buffer) gnus-current-window-configuration) 474 (cons (current-buffer) gnus-current-window-configuration)
474 nil))) 475 nil)))
475 476
476;; Summary mode commands.
477
478(defun gnus-summary-nnir-goto-thread ()
479 "Only applies to nnir groups. Go to group this article came from
480and show thread that contains this article."
481 (interactive)
482 (unless (eq 'nnir (car (gnus-find-method-for-group gnus-newsgroup-name)))
483 (error "Can't execute this command unless in nnir group"))
484 (let* ((cur (gnus-summary-article-number))
485 (group (nnir-artlist-artitem-group nnir-artlist cur))
486 (backend-number (nnir-artlist-artitem-number nnir-artlist cur))
487 (id (mail-header-id (gnus-summary-article-header)))
488 (refs (split-string
489 (mail-header-references (gnus-summary-article-header)))))
490 (if (eq (car (gnus-find-method-for-group group)) 'nnimap)
491 (progn
492 (nnimap-possibly-change-group (gnus-group-short-name group) nil)
493 (with-current-buffer (nnimap-buffer)
494 (let* ((cmd
495 (let ((value
496 (format
497 "(OR HEADER REFERENCES %s HEADER Message-Id %s)"
498 id id)))
499 (dolist (refid refs value)
500 (setq value
501 (format
502 "(OR (OR HEADER Message-Id %s HEADER REFERENCES %s) %s)"
503 refid refid value)))))
504 (result (nnimap-command "UID SEARCH %s" cmd)))
505 (gnus-summary-read-group-1
506 group t t gnus-summary-buffer nil
507 (and (car result)
508 (delete 0 (mapcar
509 #'string-to-number
510 (cdr (assoc "SEARCH" (cdr result))))))))))
511 (gnus-summary-read-group-1 group t t gnus-summary-buffer
512 nil (list backend-number))
513 (gnus-summary-refer-thread))))
514
515
516(if (fboundp 'eval-after-load)
517 (eval-after-load "gnus-sum"
518 '(define-key gnus-summary-goto-map
519 "T" 'gnus-summary-nnir-goto-thread))
520 (add-hook 'gnus-summary-mode-hook
521 (function (lambda ()
522 (define-key gnus-summary-goto-map
523 "T" 'gnus-summary-nnir-goto-thread)))))
524
525
526 477
527;; Gnus backend interface functions. 478;; Gnus backend interface functions.
528 479
@@ -656,6 +607,13 @@ and show thread that contains this article."
656 (gnus-group-real-name to-newsgroup))) ; Is this move internal 607 (gnus-group-real-name to-newsgroup))) ; Is this move internal
657 )) 608 ))
658 609
610(deffoo nnir-warp-to-article ()
611 (let* ((cur (gnus-summary-article-number))
612 (gnus-newsgroup-name (nnir-artlist-artitem-group nnir-artlist cur))
613 (backend-number (nnir-artlist-artitem-number nnir-artlist cur)))
614 (gnus-summary-read-group-1 gnus-newsgroup-name t t gnus-summary-buffer
615 nil (list backend-number))))
616
659(nnoo-define-skeleton nnir) 617(nnoo-define-skeleton nnir)
660 618
661 619