From: Tassilo Horn <tsdh@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Sorting with threads in Gnus
Date: Fri, 26 Jul 2013 15:26:38 +0200 [thread overview]
Message-ID: <87li4twiy9.fsf@thinkpad.tsdh.org> (raw)
In-Reply-To: 87ppu5wjw8.fsf@thinkpad.tsdh.org
Tassilo Horn <tsdh@gnu.org> writes:
>> But I'll bet with a little care, it would be possible to make a
>> gnus-sort-threads-recursively-p option, which would have
>> gnus-sort-threads break to gnus-sort-articles after the first round
>> of sorting... Maybe.
>
> That would be awesome.
That was easier than expected. The following patch (with setting
gnus-sort-threads-recursively to nil) seems to achieve exactly what I
want.
--8<---------------cut here---------------start------------->8---
diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el
index f3918b0..15cbb5a 100644
--- a/lisp/gnus-sum.el
+++ b/lisp/gnus-sum.el
@@ -847,6 +847,13 @@ controls how articles are sorted."
(function :tag "other"))
(boolean :tag "Reverse order"))))
+(defcustom gnus-sort-threads-recursively t
+ "If non-nil, `gnus-thread-sort-functions' are applied recursively.
+Setting this to nil allows sorting high-score, recent,
+etc. threads to the top of the summary buffer while still
+retaining chronological old to new sorting order inside threads."
+ :group 'gnus-summary-sort
+ :type 'boolean)
(defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
"*List of functions used for sorting threads in the summary buffer.
@@ -4876,9 +4883,11 @@ If LINE, insert the rebuilt thread starting on line LINE."
(gnus-message 8 "Sorting threads...")
(prog1
(condition-case nil
- (let ((max-lisp-eval-depth (max max-lisp-eval-depth 5000)))
- (gnus-sort-threads-recursive
- threads (gnus-make-sort-function gnus-thread-sort-functions)))
+ (let ((max-lisp-eval-depth (max max-lisp-eval-depth 5000))
+ (sort-func (gnus-make-sort-function gnus-thread-sort-functions)))
+ (if gnus-sort-threads-recursively
+ (gnus-sort-threads-recursive threads sort-func)
+ (sort threads sort-func)))
;; Even after binding max-lisp-eval-depth, the recursive
;; sorter might fail for very long threads. In that case,
;; try using a (less well-tested) non-recursive sorter.
--8<---------------cut here---------------end--------------->8---
It would be good if others could test-drive it a bit more. If it
doesn't break anything, I'm going to add some docs and commit it in the
Gnus master branch.
Bye,
Tassilo
next prev parent reply other threads:[~2013-07-26 13:26 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-23 8:49 Sorting with threads in Gnus N. Raghavendra
2013-07-24 6:21 ` Eric Abrahamsen
2013-07-24 8:17 ` N. Raghavendra
2013-07-24 13:15 ` Tassilo Horn
2013-07-26 4:37 ` Eric Abrahamsen
2013-07-26 5:48 ` Tassilo Horn
2013-07-26 9:01 ` Eric Abrahamsen
2013-07-26 13:06 ` Tassilo Horn
2013-07-26 13:26 ` Tassilo Horn [this message]
2013-07-26 13:43 ` Tassilo Horn
2013-07-26 15:26 ` Eric Abrahamsen
2013-07-26 16:56 ` Tassilo Horn
2013-07-27 7:08 ` Eric Abrahamsen
2013-07-26 17:40 ` N. Raghavendra
2013-07-27 8:56 ` Tassilo Horn
2013-07-27 9:19 ` N. Raghavendra
2013-07-29 6:53 ` Tassilo Horn
2013-07-29 7:42 ` N. Raghavendra
2013-07-28 7:09 ` N. Raghavendra
2013-07-28 8:03 ` Michael Heerdegen
2013-07-28 9:50 ` N. Raghavendra
2013-07-28 12:45 ` Michael Heerdegen
2013-07-28 16:17 ` N. Raghavendra
2013-07-30 7:05 ` Tassilo Horn
2013-07-30 7:24 ` Eric Abrahamsen
2013-07-30 8:01 ` Tassilo Horn
2013-07-30 10:53 ` Eric Abrahamsen
2013-07-29 5:16 ` N. Raghavendra
2013-07-30 8:07 ` Tassilo Horn
2013-07-30 11:00 ` N. Raghavendra
2013-07-30 12:33 ` Tassilo Horn
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=87li4twiy9.fsf@thinkpad.tsdh.org \
--to=tsdh@gnu.org \
--cc=help-gnu-emacs@gnu.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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.