From 2492ccf5708acb640cda82614aa11d9defae5b42 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Thu, 2 Dec 2004 22:50:57 +0000 Subject: [PATCH] Synch to No Gnus 200412022235. --- lisp/ChangeLog | 9 ++++++++ lisp/gnus-sum.el | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5554b4b..af162aa 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2004-12-02 Reiner Steib + + * gnus-sum.el (gnus-summary-limit-to-recipient): New function. + Suggested David Mazieres in analogy to rmail-summary-by-recipients. + (gnus-summary-limit-map, gnus-summary-make-menu-bar): Add it. + (gnus-article-sort-by-recipient, gnus-summary-sort-by-recipient): + New functions. Suggested by Uwe Brauer . + (gnus-summary-mode-map, gnus-summary-make-menu-bar): Add it. + 2004-12-02 Katsumi Yamaoka * message.el (message-forward-make-body-mml): Remove headers diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el index d7c5bcc..0fa4cfc 100644 --- a/lisp/gnus-sum.el +++ b/lisp/gnus-sum.el @@ -1745,6 +1745,7 @@ increase the score of each group you read." "\C-c\C-s\C-l" gnus-summary-sort-by-lines "\C-c\C-s\C-c" gnus-summary-sort-by-chars "\C-c\C-s\C-a" gnus-summary-sort-by-author + "\C-c\C-s\C-t" gnus-summary-sort-by-recipient "\C-c\C-s\C-s" gnus-summary-sort-by-subject "\C-c\C-s\C-d" gnus-summary-sort-by-date "\C-c\C-s\C-i" gnus-summary-sort-by-score @@ -1855,7 +1856,8 @@ increase the score of each group you read." "C" gnus-summary-limit-mark-excluded-as-read "o" gnus-summary-insert-old-articles "N" gnus-summary-insert-new-articles - "r" gnus-summary-limit-to-replied) + "r" gnus-summary-limit-to-replied + "R" gnus-summary-limit-to-recipient) (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map) "n" gnus-summary-next-unread-article @@ -2458,6 +2460,7 @@ gnus-summary-show-article-from-menu-as-charset-%s" cs)))) ["Marks..." gnus-summary-limit-to-marks t] ["Subject..." gnus-summary-limit-to-subject t] ["Author..." gnus-summary-limit-to-author t] + ["Recipient..." gnus-summary-limit-to-recipient t] ["Age..." gnus-summary-limit-to-age t] ["Extra..." gnus-summary-limit-to-extra t] ["Score..." gnus-summary-limit-to-score t] @@ -2522,6 +2525,7 @@ gnus-summary-show-article-from-menu-as-charset-%s" cs)))) ("Sort" ["Sort by number" gnus-summary-sort-by-number t] ["Sort by author" gnus-summary-sort-by-author t] + ["Sort by recipient" gnus-summary-sort-by-recipient t] ["Sort by subject" gnus-summary-sort-by-subject t] ["Sort by date" gnus-summary-sort-by-date t] ["Sort by score" gnus-summary-sort-by-score t] @@ -4566,6 +4570,18 @@ using some other form will lead to serious barfage." (gnus-article-sort-by-author (gnus-thread-header h1) (gnus-thread-header h2))) +(defsubst gnus-article-sort-by-recipient (h1 h2) + "Sort articles by recipient." + (string-lessp + (let ((extract (funcall + gnus-extract-address-components + (or (cdr (assq 'To (mail-header-extra h1))) "")))) + (or (car extract) (cadr extract))) + (let ((extract (funcall + gnus-extract-address-components + (or (cdr (assq 'To (mail-header-extra h2))) "")))) + (or (car extract) (cadr extract))))) + (defsubst gnus-article-sort-by-subject (h1 h2) "Sort articles by root subject." (string-lessp @@ -7681,6 +7697,41 @@ If NOT-MATCHING, excluding articles that have authors that match a regexp." current-prefix-arg)) (gnus-summary-limit-to-subject from "from" not-matching)) +(defun gnus-summary-limit-to-recipient (recipient &optional not-matching) + "Limit the summary buffer to articles with the given RECIPIENT. + +To and Cc headers are checked. You need to include them in +`nnmail-extra-headers'." + ;; Unlike `rmail-summary-by-recipients', doesn't include From. + (interactive + (list (read-string (format "%s recipient (regexp): " + (if current-prefix-arg "Exclude" "Limit to"))) + current-prefix-arg)) + (when (not (equal "" recipient)) + (prog1 (let* ((articles1 + (if (memq 'To nnmail-extra-headers) + (gnus-summary-find-matching + (cons 'extra 'To) recipient 'all nil nil + not-matching) + (gnus-message + 1 "`To' isn't present in `nnmail-extra-headers'") + (sit-for 1) + nil)) + (articles2 + (if (memq 'Cc nnmail-extra-headers) + (gnus-summary-find-matching + (cons 'extra 'Cc) recipient 'all nil nil + not-matching) + (gnus-message + 1 "`Cc' isn't present in `nnmail-extra-headers'") + (sit-for 1) + nil)) + (articles (nconc articles1 articles2))) + (unless articles + (error "Found no matches for \"%s\"" recipient)) + (gnus-summary-limit articles)) + (gnus-summary-position-point)))) + (defun gnus-summary-limit-to-age (age &optional younger-p) "Limit the summary buffer to articles that are older than (or equal) AGE days. If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to @@ -10909,6 +10960,13 @@ Argument REVERSE means reverse order." (interactive "P") (gnus-summary-sort 'author reverse)) +(defun gnus-summary-sort-by-recipient (&optional reverse) + "Sort the summary buffer by recipient name alphabetically. +If `case-fold-search' is non-nil, case of letters is ignored. +Argument REVERSE means reverse order." + (interactive "P") + (gnus-summary-sort 'recipient reverse)) + (defun gnus-summary-sort-by-subject (&optional reverse) "Sort the summary buffer by subject alphabetically. `Re:'s are ignored. If `case-fold-search' is non-nil, case of letters is ignored. -- 1.7.10.4