ab920a06607c2ef5989fe3e5671daf294c0e25eb HEAD gnussort Author: Michael Welsh Duggan Date: Thu Jan 29 10:07:35 2015 -0500 Sort threads after gathering them. Gnus sorts threads, and then gathers subjects into threads. This can cause threads to be sorted improperly. 1 file changed, 11 insertions(+), 3 deletions(-) lisp/gnus/gnus-sum.el | 14 +++++++++++--- Modified lisp/gnus/gnus-sum.el diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index e4c144b..3f1d8c6 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -4149,8 +4149,8 @@ If SELECT-ARTICLES, only select those articles from GROUP." (gnus-summary-prepare-threads (if gnus-show-threads (gnus-sort-gathered-threads - (funcall gnus-summary-thread-gathering-function - (gnus-sort-threads + (gnus-sort-threads + (funcall gnus-summary-thread-gathering-function (gnus-cut-threads (gnus-make-threads))))) ;; Unthreaded display. (gnus-sort-articles gnus-newsgroup-headers)))) @@ -4874,6 +4874,12 @@ If LINE, insert the rebuilt thread starting on line LINE." (1+ (point-at-eol)) (gnus-delete-line))))))) +(defun gnus-make-threaded-sort (func) + (gnus-byte-compile + `(lambda (t1 t2) + (,func (if (stringp (car t1)) (cdr t1) t1) + (if (stringp (car t2)) (cdr t2) t2))))) + (defun gnus-sort-threads-recursive (threads func) ;; Responsible for sorting the root articles of threads. (let ((subthread-sort-func (if (eq gnus-subthread-sort-functions @@ -4920,7 +4926,9 @@ If LINE, insert the rebuilt thread starting on line LINE." (prog1 (condition-case nil (let ((max-lisp-eval-depth (max max-lisp-eval-depth 5000)) - (sort-func (gnus-make-sort-function gnus-thread-sort-functions))) + (sort-func + (gnus-make-threaded-sort + (gnus-make-sort-function gnus-thread-sort-functions)))) (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,