[gnus git] branch master updated: m0-7-182-g1b6e9cb =1= Improve subthread sorting.

Tassilo Horn <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  1b6e9cb5f775fc0c47e3571a536139df7d205a42 (commit)
      from  6d79431c9eb14bc003c7be5e1f7d90669d17beb7 (commit)


- Log -----------------------------------------------------------------
commit 1b6e9cb5f775fc0c47e3571a536139df7d205a42
Author: Tassilo Horn <[email protected]>
Date:   Tue Jul 30 08:54:34 2013 +0200

    Improve subthread sorting.
    
    * gnus-sum.el (gnus-sort-subthreads-recursive): New function.
    (gnus-sort-threads-recursive): Use it.
    (gnus-sort-threads): Unconditionally call `gnus-sort-threads-recursive'
    again.  Now that determines how to sort subthreads.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4d4afcc..b3d0ea5 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+2013-07-30  Tassilo Horn  <[email protected]>
+
+	* gnus-sum.el (gnus-sort-subthreads-recursive): New function.
+	(gnus-sort-threads-recursive): Use it.
+	(gnus-sort-threads): Unconditionally call `gnus-sort-threads-recursive'
+	again.  Now that determines how to sort subthreads.
+
 2013-07-26  Tassilo Horn  <[email protected]>
 
 	* gnus-sum.el (gnus-sort-threads-recursively): New defcustom.
diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el
index 15cbb5a..614859b 100644
--- a/lisp/gnus-sum.el
+++ b/lisp/gnus-sum.el
@@ -4854,10 +4854,23 @@ If LINE, insert the rebuilt thread starting on line LINE."
 	    (gnus-delete-line)))))))
 
 (defun gnus-sort-threads-recursive (threads func)
+  ;; Responsible for sorting the root articles of threads.
+  (let ((subthread-sort-func (if gnus-sort-threads-recursively
+				 func
+			       #'gnus-thread-sort-by-date)))
+    (sort (mapcar (lambda (thread)
+		    (cons (car thread)
+			  (and (cdr thread)
+			       (gnus-sort-subthreads-recursive
+				(cdr thread) subthread-sort-func))))
+		  threads) func)))
+
+(defun gnus-sort-subthreads-recursive (threads func)
+  ;; Responsible for sorting subthreads.
   (sort (mapcar (lambda (thread)
 		  (cons (car thread)
 			(and (cdr thread)
-			     (gnus-sort-threads-recursive (cdr thread) func))))
+			     (gnus-sort-subthreads-recursive (cdr thread) func))))
 		threads) func))
 
 (defun gnus-sort-threads-loop (threads func)
@@ -4885,9 +4898,7 @@ If LINE, insert the rebuilt thread starting on line LINE."
 	(condition-case nil
 	    (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)))
+	      (gnus-sort-threads-recursive 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.

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog   |    7 +++++++
 lisp/gnus-sum.el |   19 +++++++++++++++----
 2 files changed, 22 insertions(+), 4 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.