Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
From: Bastien <bzg@gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: info-gnus-english@gnu.org
Subject: Re: Sort by thread's size?
Date: Tue, 11 Sep 2012 10:52:33 +0200	[thread overview]
Message-ID: <87pq5tlz5a.fsf@gnu.org> (raw)
In-Reply-To: <871uig8nl6.fsf@gnus.org> (Lars Ingebrigtsen's message of "Wed, 05 Sep 2012 18:02:29 +0200")

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	other threads:[~2012-09-11  8:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.4128.1341510122.855.info-gnus-english@gnu.org>
2012-09-05 16:02 ` Lars Ingebrigtsen
2012-09-11  8:52   ` Bastien [this message]
2012-09-11 12:27     ` Bastien
2012-07-05 17:42 Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pq5tlz5a.fsf@gnu.org \
    --to=bzg@gnu.org \
    --cc=info-gnus-english@gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).