info-gnus-english
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sort by thread's size?


From: Bastien
Subject: Re: Sort by thread's size?
Date: Tue, 11 Sep 2012 10:52:33 +0200
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2.50 (gnu/linux)

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Bastien <bzg@gnu.org> writes:
>
>> I'd like to sort emails in a group by threads' size.
>
> I don't think Gnus has any built-in functionality for doing that, but it
> shouldn't be that difficult to write yourself.  

Thanks!

This is what I use now:

(defun gnus-thread-sort-by-length (h1 h2)
  "Sort threads by the sum of all articles in the thread."
  (> (gnus-thread-total-length h1)
     (gnus-thread-total-length h2)))

(defun gnus-thread-total-length (thread)
  "Find the total number of articles in THREAD."
  (cond
   ((null thread) 0)
   ((listp thread) (length thread))))

(setq gnus-thread-sort-functions
      '(gnus-thread-sort-by-number
        gnus-thread-sort-by-articles-number))

It seems to work fine. `gnus-thread-total-length' is simpler
than `gnus-thread-total-score' but I think it does the right
thing -- please double-check.

Feel free to integrate this in Gnus if this is useful enough.

I use it when catching up on mailing lists and groups: short
threads are likely to be treated in 2 minutes, while long ones
require more attention/reading/brain.

-- 
 Bastien



reply via email to

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