From: Tassilo Horn Date: Fri, 26 Jul 2013 22:24:33 +0000 (+0000) Subject: Gnus: Add option to sort threads non-recursively X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1698^2~26 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=13afd560a137730c2fd22b9ee664867f9d4e17d6;p=emacs.git Gnus: Add option to sort threads non-recursively gnus-sum.el (gnus-sort-threads-recursively): New defcustom. (gnus-sort-threads): Use it. gnus.texi (Sorting the Summary Buffer): Document new defcustom `gnus-sort-threads-recursively'. --- diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index da2491cb94a..50214bb364c 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,8 @@ +2013-07-26 Tassilo Horn + + * gnus.texi (Sorting the Summary Buffer): Document new defcustom + `gnus-sort-threads-recursively'. + 2013-07-25 Glenn Morris * Makefile.in (INFO_TARGETS, DVI_TARGETS, PDF_TARGETS): Add ido. diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index be0425a679b..5f9e0b9db28 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -7394,6 +7394,11 @@ say something like: gnus-thread-sort-by-score)) @end lisp +By default, threads are sorted recursively, that is, first the roots, +then all subthreads, and so on. If you feel more like sorting only +the roots, so that inside a thread the original chronological order is +retained, you can set @code{gnus-sort-threads-recursively} to nil. + @vindex gnus-thread-score-function The function in the @code{gnus-thread-score-function} variable (default @code{+}) is used for calculating the total score of a thread. Useful diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index a67c55947ac..c32853a2a9f 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,8 @@ +2013-07-26 Tassilo Horn + + * gnus-sum.el (gnus-sort-threads-recursively): New defcustom. + (gnus-sort-threads): Use it. + 2013-07-25 Andreas Schwab * gnus-art.el (gnus-button-url-regexp): Make it match url in which diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index f3918b0a215..15cbb5a45e6 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/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.