34.3 Moving Among Messages

The most basic thing to do with a message is to read it. The way to do this in Rmail is to make the message current. The usual practice is to move sequentially through the file, since this is the order of receipt of messages. When you enter Rmail, you are positioned at the first message that you have not yet made current (that is, the first one that has the ‘unseen’ attribute; see Rmail Attributes). Move forward to see the other new messages; move backward to re-examine old messages.

n

Move to the next nondeleted message, skipping any intervening deleted messages (rmail-next-undeleted-message).

p

Move to the previous nondeleted message (rmail-previous-undeleted-message).

M-n

Move to the next message, including deleted messages (rmail-next-message).

M-p

Move to the previous message, including deleted messages (rmail-previous-message).

C-c C-n

Move to the next message with the same subject as the current one (rmail-next-same-subject).

C-c C-p

Move to the previous message with the same subject as the current one (rmail-previous-same-subject).

j

Move to the first message. With argument n, move to message number n (rmail-show-message).

>

Move to the last message (rmail-last-message).

<

Move to the first message (rmail-first-message).

M-s regexp RET

Move to the next message containing a match for regexp (rmail-search).

- M-s regexp RET

Move to the previous message containing a match for regexp. (This is M-s with a negative argument.)

n and p are the usual way of moving among messages in Rmail. They move through the messages sequentially, but skip over deleted messages, which is usually what you want to do. Their command definitions are named rmail-next-undeleted-message and rmail-previous-undeleted-message. If you do not want to skip deleted messages—for example, if you want to move to a message to undelete it—use the variants M-n and M-p (rmail-next-message and rmail-previous-message). A numeric argument to any of these commands serves as a repeat count.

In Rmail, you can specify a numeric argument by typing just the digits. You don’t need to type C-u first. You can also specify a negative argument by typing just -.

The M-s (rmail-search) command is Rmail’s version of search. The usual incremental search command C-s works in Rmail, but it searches only within the current message. The purpose of M-s is to search for another message. It reads a regular expression (see Syntax of Regular Expressions) nonincrementally, then searches starting at the beginning of the following message for a match. It then selects that message. If regexp is empty, M-s reuses the regexp used the previous time.

To search backward in the file for another message, give M-s a negative argument. In Rmail you can do this with - M-s. This begins searching from the end of the previous message.

It is also possible to search for a message based on labels. See Labels.

The C-c C-n (rmail-next-same-subject) command moves to the next message with the same subject as the current one. A prefix argument serves as a repeat count. With a negative argument, this command moves backward, acting like C-c C-p (rmail-previous-same-subject). When comparing subjects, these commands ignore the prefixes typically added to the subjects of replies. These commands are useful for reading all of the messages pertaining to the same subject, a.k.a. thread.

To move to a message specified by absolute message number, use j (rmail-show-message) with the message number as argument. With no argument, j selects the first message. < (rmail-first-message) also selects the first message. > (rmail-last-message) selects the last message.