[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (gnus-summary-sort-by-recipient): new function
From: |
Reiner Steib |
Subject: |
Re: (gnus-summary-sort-by-recipient): new function |
Date: |
Thu, 24 Jun 2004 10:14:32 +0200 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux) |
On Wed, Jun 23 2004, Uwe Brauer wrote:
> Signaling: (wrong-type-argument listp gnus-thread-sort-by-recipient)
> gnus-make-sort-function(gnus-thread-sort-by-recipient)
> gnus-sort-threads [...]
Well, I only tested it with threading turned off. (Does it make sense
with threading?)
Does the following work? Would it make sense to include the function
in Gnus?
--8<---------------cut here---------------start------------->8---
(defun rs-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))
(defsubst rs-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)))))
(defun rs-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)))
;; Not using my own namespace prefix because `gnus-summary-sort' wants
;; gnus-thread-sort-by-%s" and "gnus-article-sort-by-%s":
(require 'gnus-sum)
(unless (fboundp 'gnus-article-sort-by-recipient)
(defalias 'gnus-article-sort-by-recipient
'rs-gnus-article-sort-by-recipient))
(unless (fboundp 'gnus-thread-sort-by-recipient)
(defalias 'gnus-thread-sort-by-recipient
'rs-gnus-thread-sort-by-recipient))
--8<---------------cut here---------------end--------------->8---
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- PGP key available via WWW http://rsteib.home.pages.de/