# Managing Messages
by Brent Welch

You can take three basic actions with a mail message: leave it alone, delete it, or refile it to another folder. exmh automatically advances to the next message after you delete or refile the current message. This makes it easy to go through your mail messages, deleting and refiling as you go. Several settings under the `Scan Listing` preferences section control the behavior of exmh when reading mail. ("Scan listing" is another name for the table of contents window.) Some of these settings are mentioned below.

Like xmh, exmh handles delete and refile operations in two steps. In the first step you mark a message as needing some action. Later, you commit these changes by pressing the `Commit` button or by pressing <Control-Return>. Unlike xmh, however, exmh requires that you commit changes before you view a different folder. Marked messages are highlighted in the table of contents, as described above. If you reselect a message marked for refiling, the destination folder for that message is shown in the Status line.

## Deleting Messages

To delete a message, use the `Delete` button or press d. `Delete` results in a call to rmm. If you want deleted messages to be refiled into a special folder (e.g., +wastebasket or +deleted), you'll have to define a shell script and register that as your rmmproc in your MH profile.

Tip: If you press D to delete a message, exmh advances to the next message without displaying it. This is a quick way to clean up a folder.

## Refiling Messages

To refile a message, click the third button on the destination folder. This marks the current message(s) for refile to that folder and leaves the folder selected as the current target folder. If the right target is already selected, then you can use the `Move` button or type m to refile the message and advance to the next message.

Tip: If you press M to refile, exmh advances but doesn't display the next message.

## Undo

If you make a mistake, you can unmark a message with the `Unmark (Undo)` entry on the message `More...` menu. This operation applies to the currently selected message(s), not necessarily to the last message you marked for deletion or refiling. If you want to change the disposition of a message -- for example, to refile instead of delete it -- you don't need to unmark the message first. Just select it and take the new action.

Tip: Use `-` (minus) to back up to a message you just marked and u to unmark the message.

## Linking Messages

To link the current message(s) into a folder, hold the Shift key down as you click the third button on the desination folder label. If the correct folder is already selected as the target, you can also use the Link button. If you use `Link` frequently, you should adjust the `Scan Listing` preferences item for `Advance after Link`. If you turn this off, the current message remains selected after a `Link`; that makes it easier to link a message into multiple folders.

## Auto Commit

The `Auto Commit` preferences item causes exmh to automatically commit your changes when you change folders, sort or pack a folder, or quit the program. Without auto commit, you will be prompted to commit when you try to take one of these actions and have messages still marked to be deleted or refiled. `Auto Commit` also commits changes when you close the main window.

## Implied Direction

The message viewed after a `Delete` or `Move` is usually the next message. However, if you set the `Implied Direction` preference item, exmh will remember your last `Next` or `Prev` action -- and move that direction after a `Delete` or `Move`. This means it's just as convenient to go backward through a folder as to go forward -- although it might catch you by surprise.

## Skipping Marked Messages

The `skip marked msgs` preference item controls whether `Next` and `Prev` take you to a message marked for deletion or refiling, or whether those messages are skipped. Remember the handy - (minus) key binding, which takes you to the previous message even if it is marked.

## Changing Folders Automatically

When you're at the end of a folder, exmh can take you to the next folder that has unseen messages in it. (More than one folder will have unseen messages if you filter mail into different folders as it arrives. Just press the `Next` button; exmh will change folders for you. If you have marked messages, however, exmh will remind you. At this point you can press the `Commit` button -- or, if you have auto-commit enabled, then you can press the `Next` button again to trigger the commit and folder change. If you always want to be warned before an automatic folder change, enable the `Next Guard` preference item. With this enabled, you have to click `Next` twice (or type n twice) to get the automatic folder change. After you click `Next` the first time, exmh tells you what folder you'll go to when you click `Next` again.

The final twist on automatic folder changing is that, by default, exmh automatically changes back to your "first" folder if no more folders have unseen messages. You can disable this feature with the `Cycle back to first` preference item. The default `Folder-Order:` profile entry (see the Section MH Profile) defines inbox to be the first folder. So, ordinarily, you'll change back there.