Moving Your Mail Around

[previous] [next] [table of contents] [index]

Note: HTML conversion may not be complete.

This section covers how messages and folders can be moved about or manipulated. Messages may be incorporated into your +inbox, deleted, and refiled. Messages containing shar or uuencode output can be stored. Folders can be visited, sorted, packed, or deleted. Here's a list of the available commands to do these things:

Command           |  Description
__________________|____________________________________________
i                 |  Incorporate new mail into folder
d                 |  Delete message
C-d               |  Delete message, don't move to next message
M-s               |  Find messages that meet search criteria
o                 |  Output (refile) message to folder
c                 |  Copy message to folder
C-o               |  Output (write) message to file
!                 |  Repeat last refile or write
l                 |  Print message
|                 |  Pipe message through shell command
M-n               |  Unpack message created  with  uudecode  or
                  |  shar
M-l               |  List all folders
M-f               |  Visit folder
M-r               |  Regenerate scan lines
M-x mh-sort-folder|  Sort folder
M-p               |  Pack folder
M-k               |  Remove folder
x                 |  Execute pending refiles and deletes
u                 |  Undo pending refile or delete
M-u               |  Undo all pending refiles and deletes
q                 |  Quit
__________________|____________________________________________

Incorporating Your Mail

If at any time you receive new mail, incorporate the new mail into your +inbox buffer with i. Note that i will display +inbox buffer, even if there isn't any new mail. You can incorporate mail from any file into the current folder by specifying a prefix argument (that is, C-u i ~/mbox RET); you'll be prompted for the name of the file to use.

Emacs can notify you when you have new mail by displaying Mail in the mode line. To enable this behavior, and to have a clock in the mode line besides, add the following to ~/.emacs:

(display-time)

Deleting Your Mail

To delete a message, use the d command. A D is placed by the message in the scan window, and the next message is displayed. If the previous command had been p, then the next message displayed is the message previous to the message just deleted. If you specify a prefix argument, you will be prompted for a sequence to delete (for example, C-u d frombob RET). C-d deletes the message but leaves the cursor at the current message in case you wish to perform other operations on the message. See the Section Using Sequences for information on using sequences.

Organizing Your Mail with Folders

mh-e has analogies for each of the MH folder(1) and refile(1) commands. If you're unfamiliar with MH folders, you should review the Section Folders. To refile a message in another folder, use the o (mnemonic: "output") command. You are prompted for the folder name.

If you are refiling several messages into the same folder, you can use the ! command to repeat the last refile or write (see the description of C-o below). Or, place the messages into a sequence (the Section Using Sequences) and specify a prefix argument to o, in which case you'll be prompted for the name of the sequence (for example, C-u o search RET).

If you wish to copy a message to another folder, you can use the c command (see "Linking Messages into More than One Folder" in the Section Moving and Linking Messages: refile). You are prompted for a folder, and you can specify a prefix argument if you want to copy a sequence into another folder. In this case, you are then prompted for the sequence. Note that unlike the o command, the copy takes place immediately. The original copy remains in the current folder.

When you want to read the messages that you have refiled into folders, use the M-f command to visit the folder. You are prompted for the folder name. You can create folders in this way, too.

Other commands you can perform on folders include: M-l, to list all the folders in your mail directory; M-k, to remove a folder; M-x mh-sort-folder, to sort the messages by date (see the Section Sorting Messages: sortm about sorting by other criteria); M-p, to pack a folder, removing gaps from the numbering sequence; and M-r, to rescan the folder, which is useful to grab all messages in your +inbox after processing your new mail. If you don't want to rescan the entire folder, give M-r or M-p a prefix argument and you'll be prompted for a range of messages to display (for instance, C-u M-r last:50 RET).

Printing Your Mail

Printing mail is simple. Enter l (for line printer). The message is formatted with mhl (the Section Using mhl) and printed with the lpr(1) command. You can print all the messages in a sequence by specifying a prefix argument, in which case you are prompted for the name of the sequence (as in C-u l frombob RET).

Files and Pipes

mh-e does offer a couple of commands that are not a part of MH. The first one, C-o, writes a message to a file (think of the "o" as in "output"). You are prompted for the filename. If the file already exists, the message is appended to it. You can also write the message to the file without the header by specifying a prefix argument (such as C-u C-o /tmp/foobar RET). Subsequent writes to the same file can be made with the ! command.

You can also pipe the message through a UNIX shell command with the | command. You are prompted for the UNIX command through which you wish to run your message. If you give an argument to this command, the message header is included in the text passed to the command (the contrived example C-u | lpr, would be done with the l command instead).

If the message is a shell archive (shar(1)) or has been run through uuencode(1), use M-n to extract the body of the message. The default directory for extraction is the current directory, and you have a chance to specify a different extraction directory. The next time you use this command, the default directory is the last directory you used.

Finishing Up

If you've deleted a message or refiled it, but changed your mind, you can cancel the action before you've executed it. Use u to undo a refile on or deletion of a single message. You can also undo refiles and deletes for messages that belong to a given sequence by specifying a prefix argument. You'll be prompted for the name of the sequence (as in C-u u frombob RET). Alternatively, you can use M-u to undo all refiles or deletes in the current folder.

If you've marked messages to be deleted or refiled and you want to go ahead and delete or refile the messages, use x. Many mh-e commands that may affect the order of the messages (such as M-r or M-p) will ask if you want to process refiles or deletes first and then either run x for you or undo the pending refiles and deletes, which are lost.

When you want to quit using mh-e and go back to editing, you can use the q command. This buries the mh-e buffers and restores the buffers that were present when you first ran M-x mh-rmail. You can later restore your mh-e session by selecting the +inbox buffer or by running M-x mh-rmail again.

Two sequences are maintained internally by mh-e and pushed out to MH when you type either the x or q command. They are the sequence specified by your Unseen-Sequence: profile entry and cur. However, you can also just update MH's state with the command M-x mh-update-sequences. See the Section Viewing Your Mail for an example of how this command might be used.

[Table of Contents] [Index] [Previous: Editing a Draft] [Next: Searching Through Messages]


(This section was written by Bill Wohler.)
Last change $Date: 1996/07/14 17:35:00 $

This file is from the third edition of the book MH & xmh: Email for Users & Programmers, ISBN 1-56592-093-7, by Jerry Peek. Copyright © 1991, 1992, 1995 by O'Reilly & Associates, Inc. This file is freely-available; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. For more information, see the file copying.htm.

Suggestions are welcome: Bill Wohler <wohler@newt.com>

HIVE: All information for read only. Please respect copyright!
Hosted by hive КГБ: Киевская городская библиотека