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

Sorting Messages

In order to make numerous related messages easier to cope with, VM provides the command G (vm-sort-messages), which sorts all messages in a folder using one or more sort keys. By default the actual order of the messages in the folder is not altered; that is, if you looked at the folder file outside of VM the message order would be unchanged. VM numbers and presents the messages in a different order internally. If you want the message order to be changed in the folder so that other programs can see the change, you can either invoke vm-sort-messages with a prefix argument, or you can set vm-move-message-physically non-nil before sorting. Either way, VM will shift the actual messages around in the folder buffer, and when you save the folder, the order change will be visible to other programs.

Valid sort keys are: "date", "reversed-date", "author", "reversed-author", "subject", "reversed-subject", "recipients", "reversed-recipients", "line-count", "reversed-line-count", "byte-count", "reversed-byte-count", "physical-order", and "reversed-physical-order".

When sorting by subject (or threading using subjects, or killing messages by subject) the subject of the message is normalized before comparisons are done. A normalized subject has uninteresting prefixes and suffixes stripped off, and multiple consecutive whitespace characters are collapsed to a single space. The variable vm-subject-ignored-prefix should be a regular expression that matches all strings at the beginning of a subject that you do not want to be considered when message subjects are compared. A nil value means VM should not ignore any prefixes. The analogous variable for subject suffixes is vm-subject-ignored-suffix.

Once the subject has been normalized, the variable vm-subject-significant-chars controls how much of what remains is considered significant for matching purposes. The first vm-subject-significant-chars will be considered significant. Characters beyond this point in the subject string will be ignored. A nil value for this variable means all characters in the subject are significant.

If you want to move messages around by hand, use C-M-n (vm-move-message-forward) and C-M-p (vm-move-message-backward). The default is to move the current message forward or backward by one message in the message list. A prefix argument n can specify a longer move. The value of vm-move-messages-physically applies to these commands.


A thread is a group of messages that are either related by subject or that have a common ancestor. Threading is the process of determining the relationship between such messages and displaying them so that those relationships are evident.

To enable and disable threading, type C-t (vm-toggle-threads-display. In the summary buffer related messages are grouped together and the subject part of the summary listings of messages are indented to show hierarchical relationships. Parent messages are displayed before their children and children are indented a default two spaces to the right for each level of descendence from their ancestors. The amount of indentation per level is controlled by the variable vm-summary-thread-indent-level.

Message relationships are discovered by examining References, In-Reply-To, and Subject headers. The first two headers are more reliable sources of information but not all mailers provide them. If you don't want VM to use Subject headers, set the variable vm-thread-using-subject to nil.

If you want VM to always display messages using threads, you should set the default value of the variable vm-summary-show-threads non-nil in your VM init file. Exmaple:

(setq-default vm-summary-show-threads t)

Do not use setq, as this will only set the value of the variable in a single buffer. Once you've started VM you should not change the value of this variable. Rather you should use C-t to control the thread display.

Note that threading is really a specialized form of sorting, and so the value of the variable vm-move-messages-physically applies.

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