GNU Emacs Manual - Rmail Sorting

Go to the first, previous, next, last section, table of contents.

## Sorting the Rmail File

`M-x rmail-sort-by-date`
  Sort messages of current Rmail file by date.
`M-x rmail-sort-by-subject`
  Sort messages of current Rmail file by subject.
`M-x rmail-sort-by-author`
  Sort messages of current Rmail file by author's name.
`M-x rmail-sort-by-recipient`
  Sort messages of current Rmail file by recipient's names.
`M-x rmail-sort-by-correspondent`
  Sort messages of current Rmail file by the name of the other correspondent.
`M-x rmail-sort-by-lines`
  Sort messages of current Rmail file by size (number of lines).
`M-x rmail-sort-by-keywords `RET` labels `RET``
  Sort messages of current Rmail file 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 which 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 numeric 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.

Go to the first, previous, next, last section, table of contents.