Author: Michael Welsh Duggan AuthorDate: 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 @@ -4233,8 +4233,8 @@ gnus-summary-prepare (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)))) @@ -4932,6 +4932,12 @@ gnus-remove-thread-1 (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 @@ -4980,7 +4986,9 @@ gnus-sort-threads (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,