aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/gnus/ChangeLog13
-rw-r--r--lisp/gnus/gnus-sum.el57
2 files changed, 57 insertions, 13 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index c32853a2a9f..4230d010a5d 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,16 @@
12013-07-30 Tassilo Horn <tsdh@gnu.org>
2
3 * gnus-sum.el (gnus-subthread-sort-functions): New defcustom.
4 (gnus-sort-threads-recursively): Delete defcustom.
5 (gnus-sort-threads-recursive): Adapt accordingly.
6
72013-07-30 Tassilo Horn <tsdh@gnu.org>
8
9 * gnus-sum.el (gnus-sort-subthreads-recursive): New function.
10 (gnus-sort-threads-recursive): Use it.
11 (gnus-sort-threads): Unconditionally call `gnus-sort-threads-recursive'
12 again. Now that determines how to sort subthreads.
13
12013-07-26 Tassilo Horn <tsdh@gnu.org> 142013-07-26 Tassilo Horn <tsdh@gnu.org>
2 15
3 * gnus-sum.el (gnus-sort-threads-recursively): New defcustom. 16 * gnus-sum.el (gnus-sort-threads-recursively): New defcustom.
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index 15cbb5a45e6..a7269baee74 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -847,14 +847,6 @@ controls how articles are sorted."
847 (function :tag "other")) 847 (function :tag "other"))
848 (boolean :tag "Reverse order")))) 848 (boolean :tag "Reverse order"))))
849 849
850(defcustom gnus-sort-threads-recursively t
851 "If non-nil, `gnus-thread-sort-functions' are applied recursively.
852Setting this to nil allows sorting high-score, recent,
853etc. threads to the top of the summary buffer while still
854retaining chronological old to new sorting order inside threads."
855 :group 'gnus-summary-sort
856 :type 'boolean)
857
858(defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number) 850(defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
859 "*List of functions used for sorting threads in the summary buffer. 851 "*List of functions used for sorting threads in the summary buffer.
860By default, threads are sorted by article number. 852By default, threads are sorted by article number.
@@ -880,7 +872,11 @@ and `gnus-thread-sort-by-total-score' (see
880`gnus-thread-score-function'). 872`gnus-thread-score-function').
881 873
882When threading is turned off, the variable 874When threading is turned off, the variable
883`gnus-article-sort-functions' controls how articles are sorted." 875`gnus-article-sort-functions' controls how articles are sorted.
876
877By default, threads and their subthreads are sorted according to
878the value of this variable. To use a different sorting order for
879subthreads, customize `gnus-subthread-sort-functions'."
884 :group 'gnus-summary-sort 880 :group 'gnus-summary-sort
885 :type '(repeat 881 :type '(repeat
886 (gnus-widget-reversible 882 (gnus-widget-reversible
@@ -897,6 +893,28 @@ When threading is turned off, the variable
897 (function :tag "other")) 893 (function :tag "other"))
898 (boolean :tag "Reverse order")))) 894 (boolean :tag "Reverse order"))))
899 895
896(defcustom gnus-subthread-sort-functions 'gnus-thread-sort-functions
897 "*List of functions used for sorting subthreads in the summary buffer.
898By default, subthreads are sorted the same as threads, i.e.,
899according to the value of `gnus-thread-sort-functions'."
900 :group 'gnus-summary-sort
901 :type '(choice
902 (const :tag "Sort subthreads like threads" gnus-thread-sort-functions)
903 (repeat
904 (gnus-widget-reversible
905 (choice (function-item gnus-thread-sort-by-number)
906 (function-item gnus-thread-sort-by-author)
907 (function-item gnus-thread-sort-by-recipient)
908 (function-item gnus-thread-sort-by-subject)
909 (function-item gnus-thread-sort-by-date)
910 (function-item gnus-thread-sort-by-score)
911 (function-item gnus-thread-sort-by-most-recent-number)
912 (function-item gnus-thread-sort-by-most-recent-date)
913 (function-item gnus-thread-sort-by-random)
914 (function-item gnus-thread-sort-by-total-score)
915 (function :tag "other"))
916 (boolean :tag "Reverse order")))))
917
900(defcustom gnus-thread-score-function '+ 918(defcustom gnus-thread-score-function '+
901 "*Function used for calculating the total score of a thread. 919 "*Function used for calculating the total score of a thread.
902 920
@@ -4854,10 +4872,25 @@ If LINE, insert the rebuilt thread starting on line LINE."
4854 (gnus-delete-line))))))) 4872 (gnus-delete-line)))))))
4855 4873
4856(defun gnus-sort-threads-recursive (threads func) 4874(defun gnus-sort-threads-recursive (threads func)
4875 ;; Responsible for sorting the root articles of threads.
4876 (let ((subthread-sort-func (if (eq gnus-subthread-sort-functions
4877 'gnus-thread-sort-functions)
4878 func
4879 (gnus-make-sort-function
4880 gnus-subthread-sort-functions))))
4881 (sort (mapcar (lambda (thread)
4882 (cons (car thread)
4883 (and (cdr thread)
4884 (gnus-sort-subthreads-recursive
4885 (cdr thread) subthread-sort-func))))
4886 threads) func)))
4887
4888(defun gnus-sort-subthreads-recursive (threads func)
4889 ;; Responsible for sorting subthreads.
4857 (sort (mapcar (lambda (thread) 4890 (sort (mapcar (lambda (thread)
4858 (cons (car thread) 4891 (cons (car thread)
4859 (and (cdr thread) 4892 (and (cdr thread)
4860 (gnus-sort-threads-recursive (cdr thread) func)))) 4893 (gnus-sort-subthreads-recursive (cdr thread) func))))
4861 threads) func)) 4894 threads) func))
4862 4895
4863(defun gnus-sort-threads-loop (threads func) 4896(defun gnus-sort-threads-loop (threads func)
@@ -4885,9 +4918,7 @@ If LINE, insert the rebuilt thread starting on line LINE."
4885 (condition-case nil 4918 (condition-case nil
4886 (let ((max-lisp-eval-depth (max max-lisp-eval-depth 5000)) 4919 (let ((max-lisp-eval-depth (max max-lisp-eval-depth 5000))
4887 (sort-func (gnus-make-sort-function gnus-thread-sort-functions))) 4920 (sort-func (gnus-make-sort-function gnus-thread-sort-functions)))
4888 (if gnus-sort-threads-recursively 4921 (gnus-sort-threads-recursive threads sort-func))
4889 (gnus-sort-threads-recursive threads sort-func)
4890 (sort threads sort-func)))
4891 ;; Even after binding max-lisp-eval-depth, the recursive 4922 ;; Even after binding max-lisp-eval-depth, the recursive
4892 ;; sorter might fail for very long threads. In that case, 4923 ;; sorter might fail for very long threads. In that case,
4893 ;; try using a (less well-tested) non-recursive sorter. 4924 ;; try using a (less well-tested) non-recursive sorter.