[Top][All Lists]

[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: Tue, 22 Jun 2004 14:21:27 +0200
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux)

On Tue, Jun 22 2004, Uwe Brauer wrote:

> I sometimes  find in handy  to sort my  mail (in the mail sent group),
> by the recipient, which is  defined in the *to* field.
> Has anybody tried to write such a function.

Maybe like this:

--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."
   (let ((extract (funcall
                   (or (cdr (assq 'To (mail-header-extra h1))) ""))))
     (or (car extract) (cadr extract)))
   (let ((extract (funcall
                   (or (cdr (assq 'To (mail-header-extra h2))) ""))))
     (or (car extract) (cadr extract)))))

;; Not using my own namespace prefix because `gnus-summary-sort' wants
;; "gnus-article-sort-by-%s":
(require 'gnus-sum)
(unless (fboundp 'gnus-article-sort-by-recipient)
  (defalias 'gnus-article-sort-by-recipient
--8<---------------cut here---------------end--------------->8---

Bye, Reiner.
      (o o)
---ooO-(_)-Ooo--- PGP key available via WWW

reply via email to

[Prev in Thread] Current Thread [Next in Thread]