* Re: sort by receiver
[not found] <m3wun7c4kd.fsf@zeus.ece.cmu.edu>
@ 2002-11-28 2:11 ` Jesper Harder
0 siblings, 0 replies; only message in thread
From: Jesper Harder @ 2002-11-28 2:11 UTC (permalink / raw)
Zero Void <hujingcao@hotmail.com> writes:
> Is there a way to sort the emails according to receiver?
Nope, no pre-defined way.
> This will help me a lot when I want to check out an email in my
> "sent-mail" folder.
Yes, that would be nice. Here's some code to do it.
It binds `gnus-summary-sort-by-recipient' to `C-c C-s C-t'. To use it
you also need to include "To" and "Newsgroups" in overview as described
in <info://gnus/To+From+Newsgroups>.
(defun gnus-thread-sort-by-recipient (h1 h2)
"Sort threads by root recipient."
(gnus-article-sort-by-recipient
(gnus-thread-header h1) (gnus-thread-header h2)))
(defun gnus-article-sort-by-recipient (h1 h2)
"Sort articles by root recipient."
(let* ((extra1 (mail-header-extra h1))
(extra2 (mail-header-extra h2))
(group1 (cdr (assq 'Newsgroups extra1)))
(group2 (cdr (assq 'Newsgroups extra2)))
(name1 (cdr (assq 'To extra1)))
(name2 (cdr (assq 'To extra2))))
(string-lessp
(or group1
(and name1
(gnus-summary-extract-address-component
(funcall gnus-decode-encoded-word-function name1)))
"")
(or group2
(and name2
(gnus-summary-extract-address-component
(funcall gnus-decode-encoded-word-function name2)))
""))))
(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))
(define-key gnus-summary-mode-map "\C-c\C-s\C-t"
'gnus-summary-sort-by-recipient)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-11-28 2:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <m3wun7c4kd.fsf@zeus.ece.cmu.edu>
2002-11-28 2:11 ` sort by receiver Jesper Harder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).