When you no longer need to keep a message, you can delete it. This flags it as ignorable, and some Rmail commands pretend it is no longer present; but it still has its place in the Rmail file, and still has its message number.
Expunging the Rmail file actually removes the deleted messages. The remaining messages are renumbered consecutively. Expunging is the only action that changes the message number of any message, except for undigestifying (see section Digest Messages).
There are two Rmail commands for deleting messages. Both delete the
current message and select another message. d (
moves to the following message, skipping messages already deleted, while
rmail-delete-backward) moves to the previous nondeleted message.
If there is no nondeleted message to move to in the specified direction,
the message that was just deleted remains current.
To make all the deleted messages finally vanish from the Rmail file,
type x (
rmail-expunge). Until you do this, you can still
undelete the deleted messages. The undeletion command, u
rmail-undelete-previous-message), is designed to cancel the
effect of a d command in most cases. It undeletes the current
message if the current message is deleted. Otherwise it moves backward
to previous messages until a deleted message is found, and undeletes
You can usually undo a d with a u because the u moves back to and undeletes the message that the d deleted. But this does not work when the d skips a few already-deleted messages that follow the message being deleted; then the u command undeletes the last of the messages that were skipped. There is no clean way to avoid this problem. However, by repeating the u command, you can eventually get back to the message that you intend to undelete. You can also select a particular deleted message with the M-p command, then type u to undelete it.
A deleted message has the `deleted' attribute, and as a result `deleted' appears in the mode line when the current message is deleted. In fact, deleting or undeleting a message is nothing more than adding or removing this attribute. See section Labels.