[gnus git] branch master updated: m0-7-183-gfff80f8 =1= Make subthread sorting customizable and add docs for it.

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


- Log -----------------------------------------------------------------
commit fff80f88ef397fca65cb382217ce9c9a08b1329e
Author: Tassilo Horn <[email protected]>
Date:   Tue Jul 30 09:52:15 2013 +0200

    Make subthread sorting customizable and add docs for it.
    
    * gnus-sum.el (gnus-subthread-sort-functions): New defcustom.
    (gnus-sort-threads-recursively): Delete defcustom.
    (gnus-sort-threads-recursive): Adapt accordingly.
    
    * gnus.texi (Sorting the Summary Buffer): Document new defcustom
    `gnus-subthread-sort-functions' and remove the obsolete documentation
    of `gnus-sort-threads-recursively'.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b3d0ea5..a6f0f65 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,11 @@
 2013-07-30  Tassilo Horn  <[email protected]>
 
+	* gnus-sum.el (gnus-subthread-sort-functions): New defcustom.
+	(gnus-sort-threads-recursively): Delete defcustom.
+	(gnus-sort-threads-recursive): Adapt accordingly.
+
+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'
diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el
index 614859b..a7269ba 100644
--- a/lisp/gnus-sum.el
+++ b/lisp/gnus-sum.el
@@ -847,14 +847,6 @@ 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.
 By default, threads are sorted by article number.
@@ -880,7 +872,11 @@ and `gnus-thread-sort-by-total-score' (see
 `gnus-thread-score-function').
 
 When threading is turned off, the variable
-`gnus-article-sort-functions' controls how articles are sorted."
+`gnus-article-sort-functions' controls how articles are sorted.
+
+By default, threads and their subthreads are sorted according to
+the value of this variable.  To use a different sorting order for
+subthreads, customize `gnus-subthread-sort-functions'."
   :group 'gnus-summary-sort
   :type '(repeat
           (gnus-widget-reversible
@@ -897,6 +893,28 @@ When threading is turned off, the variable
                    (function :tag "other"))
            (boolean :tag "Reverse order"))))
 
+(defcustom gnus-subthread-sort-functions 'gnus-thread-sort-functions
+  "*List of functions used for sorting subthreads in the summary buffer.
+By default, subthreads are sorted the same as threads, i.e.,
+according to the value of `gnus-thread-sort-functions'."
+  :group 'gnus-summary-sort
+  :type '(choice
+	  (const :tag "Sort subthreads like threads" gnus-thread-sort-functions)
+	  (repeat
+	   (gnus-widget-reversible
+	    (choice (function-item gnus-thread-sort-by-number)
+		    (function-item gnus-thread-sort-by-author)
+		    (function-item gnus-thread-sort-by-recipient)
+		    (function-item gnus-thread-sort-by-subject)
+		    (function-item gnus-thread-sort-by-date)
+		    (function-item gnus-thread-sort-by-score)
+		    (function-item gnus-thread-sort-by-most-recent-number)
+		    (function-item gnus-thread-sort-by-most-recent-date)
+		    (function-item gnus-thread-sort-by-random)
+		    (function-item gnus-thread-sort-by-total-score)
+		    (function :tag "other"))
+	    (boolean :tag "Reverse order")))))
+
 (defcustom gnus-thread-score-function '+
   "*Function used for calculating the total score of a thread.
 
@@ -4855,9 +4873,11 @@ If LINE, insert the rebuilt thread starting on line 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
+  (let ((subthread-sort-func (if (eq gnus-subthread-sort-functions
+				     'gnus-thread-sort-functions)
 				 func
-			       #'gnus-thread-sort-by-date)))
+			       (gnus-make-sort-function
+				gnus-subthread-sort-functions))))
     (sort (mapcar (lambda (thread)
 		    (cons (car thread)
 			  (and (cdr thread)
diff --git a/texi/ChangeLog b/texi/ChangeLog
index 017d211..6a85092 100644
--- a/texi/ChangeLog
+++ b/texi/ChangeLog
@@ -1,3 +1,9 @@
+2013-07-30  Tassilo Horn  <[email protected]>
+
+	* gnus.texi (Sorting the Summary Buffer): Document new defcustom
+	`gnus-subthread-sort-functions' and remove the obsolete documentation
+	of `gnus-sort-threads-recursively'.
+
 2013-07-26  Tassilo Horn  <[email protected]>
 
 	* gnus.texi (Sorting the Summary Buffer): Document new defcustom
diff --git a/texi/gnus.texi b/texi/gnus.texi
index 2c399ff..e84487e 100644
--- a/texi/gnus.texi
+++ b/texi/gnus.texi
@@ -7394,10 +7394,13 @@ 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.
+By default, threads including their subthreads are sorted according to
+the value of @code{gnus-thread-sort-functions}.  By customizing
+@code{gnus-subthread-sort-functions} you can define a custom sorting
+order for subthreads.  This allows for example to sort threads from
+high score to low score in the summary buffer, but to have subthreads
+still sorted chronologically from old to new without taking their
+score into account.
 
 @vindex gnus-thread-score-function
 The function in the @code{gnus-thread-score-function} variable (default

-----------------------------------------------------------------------
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   |    6 ++++++
 lisp/gnus-sum.el |   42 +++++++++++++++++++++++++++++++-----------
 texi/ChangeLog   |    6 ++++++
 texi/gnus.texi   |   11 +++++++----
 4 files changed, 50 insertions(+), 15 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.