33.12 Sorting the Rmail File
C-c C-s C-d
β
M-x rmail-sort-by-date
β
Sort messages of current Rmail buffer by date.
C-c C-s C-s
β
M-x rmail-sort-by-subject
β
Sort messages of current Rmail buffer by subject.
C-c C-s C-a
β
M-x rmail-sort-by-author
β
Sort messages of current Rmail buffer by authorβs name.
C-c C-s C-r
β
M-x rmail-sort-by-recipient
β
Sort messages of current Rmail buffer by recipientβs name.
C-c C-s C-c
β
M-x rmail-sort-by-correspondent
β
Sort messages of current Rmail buffer by the name of the other correspondent.
C-c C-s C-l
β
M-x rmail-sort-by-lines
β
Sort messages of current Rmail buffer by number of lines.
C-c C-s C-k RET labels RET
β
M-x rmail-sort-by-labels RET labels RET
β
Sort messages of current Rmail buffer by labels. The argument labels
should be a comma-separated list of labels. The order of these labels specifies the order of messages; messages with the first label come first, messages with the second label come second, and so on. Messages that have none of these labels come last.
The Rmail sort commands perform a stable sort: if there is no reason to prefer either one of two messages, their order remains unchanged. You can use this to sort by more than one criterion. For example, if you use rmail-sort-by-date
and then rmail-sort-by-author
, messages from the same author appear in order by date.
With a prefix argument, all these commands reverse the order of comparison. This means they sort messages from newest to oldest, from biggest to smallest, or in reverse alphabetical order.
The same keys in the summary buffer run similar functions; for example, C-c C-s C-l
runs rmail-summary-sort-by-lines
. These commands always sort the whole Rmail buffer, even if the summary is only showing a subset of messages.
Note that you cannot undo a sort, so you may wish to save the Rmail buffer before sorting it.