gnus: Sorting the Summary Buffer

 
 3.10 Sorting the Summary Buffer
 ===============================
 
 If you are using a threaded summary display, you can sort the threads by
 setting ‘gnus-thread-sort-functions’, which can be either a single
 function, a list of functions, or a list containing functions and ‘(not
 some-function)’ elements.
 
    By default, sorting is done on article numbers.  Ready-made sorting
 predicate functions include ‘gnus-thread-sort-by-number’,
 ‘gnus-thread-sort-by-author’, ‘gnus-thread-sort-by-recipient’,
 ‘gnus-thread-sort-by-subject’, ‘gnus-thread-sort-by-date’,
 ‘gnus-thread-sort-by-score’, ‘gnus-thread-sort-by-most-recent-number’,
 ‘gnus-thread-sort-by-most-recent-date’, ‘gnus-thread-sort-by-random’ and
 ‘gnus-thread-sort-by-total-score’.
 
    Each function takes two threads and returns non-‘nil’ if the first
 thread should be sorted before the other.  Note that sorting really is
 normally done by looking only at the roots of each thread.  Exceptions
 to this rule are ‘gnus-thread-sort-by-most-recent-number’ and
 ‘gnus-thread-sort-by-most-recent-date’.
 
    If you use more than one function, the primary sort key should be the
 last function in the list.  You should probably always include
 ‘gnus-thread-sort-by-number’ in the list of sorting functions—preferably
 first.  This will ensure that threads that are equal with respect to the
 other sort criteria will be displayed in ascending article order.
 
    If you would like to sort by reverse score, then by subject, and
 finally by number, you could do something like:
 
      (setq gnus-thread-sort-functions
            '(gnus-thread-sort-by-number
              gnus-thread-sort-by-subject
              (not gnus-thread-sort-by-total-score)))
 
    The threads that have highest score will be displayed first in the
 summary buffer.  When threads have the same score, they will be sorted
 alphabetically.  The threads that have the same score and the same
 subject will be sorted by number, which is (normally) the sequence in
 which the articles arrived.
 
    If you want to sort by score and then reverse arrival order, you
 could say something like:
 
      (setq gnus-thread-sort-functions
            '((not gnus-thread-sort-by-number)
              gnus-thread-sort-by-score))
 
    By default, threads including their subthreads are sorted according
 to the value of ‘gnus-thread-sort-functions’.  By customizing
 ‘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.
 
    The function in the ‘gnus-thread-score-function’ variable (default
 ‘+’) is used for calculating the total score of a thread.  Useful
 functions might be ‘max’, ‘min’, or squared means, or whatever tickles
 your fancy.
 
    If you are using an unthreaded display for some strange reason or
 other, you have to fiddle with the ‘gnus-article-sort-functions’
 variable.  It is very similar to the ‘gnus-thread-sort-functions’,
 except that it uses slightly different functions for article comparison.
 Available sorting predicate functions are ‘gnus-article-sort-by-number’,
 ‘gnus-article-sort-by-author’, ‘gnus-article-sort-by-subject’,
 ‘gnus-article-sort-by-date’, ‘gnus-article-sort-by-random’, and
 ‘gnus-article-sort-by-score’.
 
    If you want to sort an unthreaded summary display by subject, you
 could say something like:
 
      (setq gnus-article-sort-functions
            '(gnus-article-sort-by-number
              gnus-article-sort-by-subject))
 
    You can define group specific sorting via ‘gnus-parameters’, See
 Group Parameters.