Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* Re: Sort by thread's size?
       [not found] <mailman.4128.1341510122.855.info-gnus-english@gnu.org>
@ 2012-09-05 16:02 ` Lars Ingebrigtsen
  2012-09-11  8:52   ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2012-09-05 16:02 UTC (permalink / raw)
  To: Bastien; +Cc: info-gnus-english

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.  Just look at, say,
`gnus-thread-total-score', and write a new function based on that that
counts the number of messages instead of summing the score.

-- 
(domestic pets only, the antidote for overdose, milk.)
  http://lars.ingebrigtsen.no  *  Lars Magne Ingebrigtsen

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Sort by thread's size?
  2012-09-05 16:02 ` Sort by thread's size? Lars Ingebrigtsen
@ 2012-09-11  8:52   ` Bastien
  2012-09-11 12:27     ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: Bastien @ 2012-09-11  8:52 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: info-gnus-english

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Sort by thread's size?
  2012-09-11  8:52   ` Bastien
@ 2012-09-11 12:27     ` Bastien
  0 siblings, 0 replies; 4+ messages in thread
From: Bastien @ 2012-09-11 12:27 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: info-gnus-english

Bastien <bzg@gnu.org> writes:

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

Should be `gnus-thread-sort-by-length' of course.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Sort by thread's size?
@ 2012-07-05 17:42 Bastien
  0 siblings, 0 replies; 4+ messages in thread
From: Bastien @ 2012-07-05 17:42 UTC (permalink / raw)
  To: info-gnus-english

Hi all,

I'd like to sort emails in a group by threads' size.

My use case is that I want to check unanswered emails
in a big archive of 1000 files.

Does someone have a hack for this?

I'm using Gnus v0.6 from Emacs 24.1.50.2.

Thanks!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-09-11 12:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.4128.1341510122.855.info-gnus-english@gnu.org>
2012-09-05 16:02 ` Sort by thread's size? Lars Ingebrigtsen
2012-09-11  8:52   ` Bastien
2012-09-11 12:27     ` Bastien
2012-07-05 17:42 Bastien

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).