Next: , Previous: Navigation, Up: Commands


4.2 Deleting Messages

When you no longer need to keep a message, you can delete it. This flags it as ignorable, and some IMAIL commands pretend it is no longer present; but it still has its place in the IMAIL folder, and still has its message number.

Expunging the IMAIL folder actually removes the deleted messages. The remaining messages are renumbered consecutively. Expunging is the only action that changes the message number of any message.

d
Delete the current message, and move to the next nondeleted message (imail-delete-forward).
C-d
Delete the current message, and move to the previous nondeleted message (imail-delete-backward).
u
Undelete the current message, or move back to a deleted message and undelete it (imail-undelete-previous-message).
x
Expunge the IMAIL folder (imail-expunge).

There are two IMAIL commands for deleting messages. Both delete the current message and select another message. d (imail-delete-forward) moves to the following message, skipping messages already deleted, while C-d (imail-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. A numeric argument to either command reverses the direction of motion after deletion.

To make all the deleted messages finally vanish from the IMAIL folder, type x (imail-expunge). Until you do this, you can still undelete the deleted messages. The undeletion command, u (imail-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 that message.

Because imail-expunge irreversibly deletes mail, IMAIL normally requires confirmation before it performs the expunge. This confirmation is controlled by the value of the variable imail-expunge-confirmation, which is a list of symbols. There are two independent behaviors controlled by this: whether to prompt, and whether to show the messages being expunged. If the list contains the symbol verbose (the default), the user is prompted for a yes-or-no style confirmation; if the list contains the symbol brief, the user is prompted for a y-or-n style confirmation; if neither of these symbols is present, no confirmation is done. If the list contains the symbol show-messages, a window is popped up showing the messages to be expunged; otherwise the list is not shown.

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’ flag, 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 flag. See Flags.