Go to the first, previous, next, last section, table of contents.

# Using mh-e

This chapter leaves the tutorial style and goes into more detail about every mh-e command. The default, or "out of the box," behavior is documented. If this is not to your liking (for instance, you print with something other than `lpr)`, see the associated section in section Customizing mh-e which is organized exactly like this chapter.

There are many commands, but don't get intimidated. There are command summaries at the beginning of each section. In case you have or would like to rebind the keys, the command summaries also list the associated Emacs Lisp function. Furthermore, even if you're stranded on a desert island with a laptop and are without your manuals, you can get a summary of all these commands with GNU Emacs online help: use `C-h m` (`describe-mode`) for a brief summary of commands or `C-h i` to read this manual via Info. The online help is quite good; try running `C-h C-h C-h`. This brings up a list of available help topics, one of which displays the documentation for a given key (like `C-h k C-n`). In addition, review section GNU Emacs Terms and Conventions, if any of the GNU Emacs conventions are strange to you.

Let's get started!

- Reading Mail
- Sending Mail
- Draft Editing
- Moving Mail
- Searching
- Sequences
- Miscellaneous

## Reading Your Mail

The mh-e entry point for reading mail is `M-x mh-rmail`. This command incorporates your mail and creates a buffer called ``+inbox'` in MH-Folder mode. The `M-x mh-rmail` command shows you only new mail, not old mail. (7) The ``+inbox'` buffer contains scan lines, which are one-line summaries of each incorporated message. You can perform most MH commands on these messages via one-letter commands discussed in this chapter. See `scan`(1) for a description of the contents of the scan lines, and see the Figure in section Receiving Mail, for an example.

`RET`
  Display a message (`mh-show`).
`SPC`
  Go to next page in message (`mh-page-msg`).
`DEL`
  Go to previous page in message (`mh-previous-page`).
`, (comma)`
  Display a message with all header fields (`mh-header-display`).
`M-SPC`
  Go to next message in digest (`mh-page-digest`).
`M-DEL`
  Go to previous message in digest (`mh-page-digest-backwards`).
`M-b`
  Break up digest into separate messages (`mh-burst-digest`).
`n`
  Display next message (`mh-next-undeleted-msg`).
`p`
  Display previous message (`mh-previous-undeleted-msg`).
`g`
  Go to a message (`mh-goto-msg`).
`M-<`
  Go to first message (`mh-first-msg`).
`M->`
  Go to last message (`mh-last-msg`).
`t`
  Toggle between MH-Folder and MH-Folder Show modes (`mh-toggle-showing`).

- Viewing
- Moving Around

### Viewing Your Mail

The `RET` (`mh-show`) command displays the message that the cursor is on. If the message is already displayed, it scrolls to the beginning of the message. Use `SPC` (`mh-page-msg`) and `DEL` (`mh-previous-page`) to move forwards and backwards one page at a time through the message. You can give either of these commands a prefix argument that specifies the number of lines to scroll (such as `10 SPC`). mh-e normally hides a lot of the superfluous header fields that mailers add to a message, but if you wish to see all of them, use the `,` (comma; `mh-header-display`) command.

- Reading Digests
- Reading MIME

#### Reading Digests

A digest is a message that contains other messages. Special mh-e commands let you read digests conveniently. You can use `SPC` and `DEL` to page through the digest as if it were a normal message, but if you wish to skip to the next message in the digest, use `M-SPC` (`mh-page-digest`). To return to a previous message, use `M-DEL` (`mh-page-digest-backwards`).

Another handy command is `M-b` (`mh-burst-digest`). This command uses the MH command `burst` to break out each message in the digest into its own message. Using this command, you can quickly delete unwanted messages, like this: Once the digest is split up, toggle out of MH-Folder Show mode with `t` (see section Moving Around) so that the scan lines fill the screen and messages aren't displayed. Then use `d` (see section Deleting Your Mail) to quickly delete messages that you don't want to read (based on the ``Subject:'` header field). You can also burst the digest to reply directly to the people who posted the messages in the digest. One problem you may encounter is that the ``From:'` header fields are preceded with a ``>'` so that your reply can't create the ``To:'` field correctly. In this case, you must correct the ``To:'` field yourself. This is described later in section Editing Textual Messages.

#### Reading Multimedia Mail

MH has the ability to read MIME (Multipurpose Internet Mail Extensions) messages. Unfortunately, mh-e does not yet have this ability, so you have to use the MH commands `show` or `mhn` from the shell to read MIME messages. (8)

### Moving Around

To move on to the next message, use the `n` (`mh-next-undeleted-msg`) command; use the `p` (`mh-previous-undeleted-msg`) command to read the previous message. Both of these commands can be given a prefix argument to specify how many messages to skip (for example, `5 n`). You can also move to a specific message with `g` (`mh-goto-msg`). You can enter the message number either before or after typing `g`. In the latter case, Emacs prompts you. Finally, you can go to the first or last message with `M-<` (`mh-first-msg`) and `M->` (`mh-last-msg`) respectively.

You can also use the Emacs commands `C-p` (`previous-line`) and `C-n` (`next-line`) to move up and down the scan lines in the MH-Folder window. These commands can be used in conjunction with `RET` to look at deleted or refiled messages.

The command `t` (`mh-toggle-showing`) switches between MH-Folder mode and MH-Folder Show mode. (9) MH-Folder mode turns off the associated show buffer so that you can perform operations on the messages quickly without reading them. This is an excellent way to prune out your junk mail or to refile a group of messages to another folder for later examination.

## Sending Mail

You can send a mail message in several ways. You can call `M-x mh-smail` directly, or from the command line like this:

    % emacs -f mh-smail

From within mh-e's MH-Folder mode, other methods of sending mail are available as well:

`m`
  Compose a message (`mh-send`).
`r`
  Reply to a message (`mh-reply`).
`f`
  Forward message(s) (`mh-forward`).
`M-d`
  Redistribute a message (`mh-redistribute`).
`M-e`
  Edit a message that was bounced by mailer (`mh-extract-rejected-mail`).
`M-a`
  Edit a message to send it again (`mh-edit-again`).

From within a MH-Folder buffer, you can simply use the command `m` (`mh-send`). However you invoke `mh-send`, you are prompted for the ``To:'`, ``cc:'`, and ``Subject:'` header fields. Once you've specified the recipients and subject, your message appears in an Emacs buffer whose mode is MH-Letter (see the Figure in section Sending Mail to see what the buffer looks like). MH-Letter mode allows you to edit your message, to check the validity of the recipients, to insert other messages into your message, and to send the message. We'll go more into depth about editing a draft (10) (a message you're composing) in just a moment.

`mh-smail` always creates a two-window layout with the current buffer on top and the draft on the bottom. If you would rather preserve the window layout, use `M-x mh-smail-other-window`.

- Replying
- Forwarding
- Redistributing
- Old Drafts

### Replying to Mail

To compose a reply to a message, use the `r` (`mh-reply`) command. If you supply a prefix argument (as in `C-u r`), the message you are replying to is inserted in your reply after having first been run through `mhl` with the format file ``mhl.reply'`. See `mhl`(1) to see how you can modify the default ``mhl.reply'` file.

When you reply to a message, you are first prompted with ``Reply to whom?'`. You have several choices here.

    Response     Reply Goes To

    from         The person who sent the message.  This is the default,
                 so RET is sufficient.

    to           Replies to the sender, plus all recipients in the
                 `To:' header field.

    all
    cc           Forms a reply to the sender, plus all recipients.

Depending on your answer, `repl` is given a different argument to form your reply. Specifically, a choice of `from` or none at all runs `repl -nocc all`, and a choice of `to` runs `repl -cc to`. Finally, either `cc` or `all` runs `repl -cc all -nocc me`.

Two windows are then created. One window contains the message to which you are replying. Your draft, in MH-Letter mode (described in section Editing a Draft), is in the other window.

If you wish to customize the header or other parts of the reply draft, please see `repl`(1) and `mh-format`(5).

### Forwarding Mail

To forward a message, use the `f` (`mh-forward`) command. You are given a draft to edit that looks like it would if you had run the MH command `forw`. You are given a chance to add some text (see section Editing a Draft).

You can forward several messages by using a prefix argument; in this case, you are prompted for the name of a sequence, a symbolic name that represents a list or range of message numbers (for example, `C-u f forbob `RET``). All of the messages in the sequence are inserted into your draft. By the way, although sequences are often mentioned in this chapter, you don't have to worry about them for now; the full description of sequences in mh-e is at the end in section Using Sequences. To learn more about sequences in general, please see `mh-sequence`(5).

### Redistributing Your Mail

The command `M-d` (`mh-redistribute`) is similar in function to forwarding mail, but it does not allow you to edit the message, nor does it add your name to the ``From:'` header field. It appears to the recipient as if the message had come from the original sender. For more information on redistributing messages, see `dist`(1). Also investigate the `M-a` (`mh-edit-again`) command in section Editing Old Drafts and Bounced Messages, for another way to redistribute messages.

### Editing Old Drafts and Bounced Messages

If you don't complete a draft for one reason or another, and if the draft buffer is no longer available, you can pick your draft up again with `M-a` (`mh-edit-again`). If you don't use a draft folder, your last ``draft'` file will be used. If you use draft folders, you'll need to visit the draft folder with `M-f drafts `RET``, use `n` to move to the appropriate message, and then use `M-a` to prepare the message for editing.

The `M-a` command can also be used to take messages that were sent to you and to send them to more people.

Don't use `M-a` to re-edit a message from a Mailer-Daemon who complained that your mail wasn't posted for some reason or another. In this case, use `M-e` (`mh-extract-rejected-mail`) to prepare the message for editing by removing the Mailer-Daemon envelope and unneeded header fields. Fix whatever addressing problem you had, and send the message again with `C-c C-c`.

## Editing a Draft

When you edit a message that you want to send (called a draft in this case), the mode used is MH-Letter. This mode provides several commands in addition to the normal Emacs editing commands to help you edit your draft.

`C-c C-y`
  Insert contents of message to which you're replying (`mh-yank-cur-msg`).
`C-c C-i`
  Insert a message from a folder (`mh-insert-letter`).
`C-c C-f C-t`
  Move to ``To:'` header field (`mh-to-field`).
`C-c C-f C-c`
  Move to ``cc:'` header field (`mh-to-field`).
`C-c C-f C-s`
  Move to ``Subject:'` header field (`mh-to-field`).
`C-c C-f C-f`
  Move to ``From:'` header field (`mh-to-field`).
`C-c C-f C-b`
  Move to ``Bcc:'` header field (`mh-to-field`).
`C-c C-f C-f`
  Move to ``Fcc:'` header field (`mh-to-fcc`).
`C-c C-f C-d`
  Move to ``Dcc:'` header field (`mh-to-field`).
`C-c C-w`
  Display expanded recipient list (`mh-check-whom`).
`C-c C-s`
  Insert signature in message (`mh-insert-signature`).
`C-c C-m C-f`
  Include forwarded message (MIME) (`mh-mhn-compose-forw`).
`C-c C-m C-e`
  Include anonymous ftp reference (MIME) (`mh-mhn-compose-anon-ftp`).
`C-c C-m C-t`
  Include anonymous ftp reference to compressed tar file (MIME) (`mh-mhn-compose-external-compressed-tar`).
`C-c C-m C-i`
  Include binary, image, sound, etc. (MIME) (`mh-mhn-compose-insertion`).
`C-c C-e`
  Run through `mhn` before sending (`mh-edit-mhn`).
`C-c C-m C-u`
  Undo effects of `mhn` (`mh-revert-mhn-edit`).
`C-c C-c`
  Save draft and send message (`mh-send-letter`).
`C-c C-q`
  Quit editing and delete draft message (`mh-fully-kill-draft`).

- Editing Textual
- Editing MIME
- Sending Message
- Killing Draft

### Editing Textual Messages

The following sections show you how to edit a draft. The commands described here are also applicable to messages that have multimedia components.

- Inserting Letter
- Inserting Messages
- Header
- Recipients
- Signature

#### Inserting letter to which you're replying

It is often useful to insert a snippet of text from a letter that someone mailed to provide some context for your reply. The command `C-c C-y` (`mh-yank-cur-msg`) does this by yanking a portion of text from the message to which you're replying and inserting ``> '` before each line.

You can control how much text is included when you run this command. If you run this command right away, without entering the buffer containing the message to you, this command will yank the entire message, as is, into your reply. (11) If you enter the buffer containing the message sent to you and move the cursor to a certain point and return to your reply and run `C-c C-y`, then the text yanked will range from that point to the end of the message. Finally, the most common action you'll perform is to enter the message sent to you, move the cursor to the beginning of a paragraph or phrase, set the mark with `C-SPC` or `C-@`, and move the cursor to the end of the paragraph or phrase. The cursor position is called the point, and the space between the mark and point is called the region. Having done that, `C-c C-y` will insert the region you selected.

#### Inserting messages

Messages can be inserted with `C-c C-i` (`mh-insert-letter`). This command prompts you for the folder and message number and inserts the message, indented by ``> '`. Certain undesirable header fields are removed before insertion. If given a prefix argument (like `C-u C-c C-i`), the header is left intact, the message is not indented, and ``> '` is not inserted before each line.

#### Editing the header

Because the header is part of the message, you can edit the header fields as you wish. However, several convenience functions exist to help you create and edit them. For example, the command `C-c C-f C-t` (`mh-to-field`; alternatively, `C-c C-f t`) moves the cursor to the ``To:'` header field, creating it if necessary. The functions to move to the ``cc:'`, ``Subject:'`, ``From:'`, ``Bcc:'`, and ``Dcc:'` header fields are similar.

One function behaves differently from the others, namely, `C-c C-f C-f` (`mh-to-fcc`; alternatively, `C-c C-f f`). This function will prompt you for the folder name in which to file a copy of the draft.

Be sure to leave a row of dashes or a blank line between the header and the body of the message.

#### Checking recipients

The `C-c C-w` (`mh-check-whom`) command expands aliases so you can check the actual address(es) in the alias. A new buffer is created with the output of `whom`.

#### Inserting your signature

You can insert your signature at the current cursor location with the `C-c C-s` (`mh-insert-signature`) command. The text of your signature is taken from the file ``~/.signature'`.

### Editing Multimedia Messages

mh-e has the capability to create multimedia messages. It uses the MIME (Multipurpose Internet Mail Extensions) protocol. The MIME protocol allows you to incorporate images, sound, video, binary files, and even commands that fetch a file with ``ftp'` when your recipient reads the message! If you were to create a multimedia message with plain MH commands, you would use `mhn`. Indeed, the mh-e MIME commands merely insert `mhn` directives which are later expanded by `mhn`.

Each of the mh-e commands for editing multimedia messages or for incorporating multimedia objects is prefixed with `C-c C-m` .

Several MIME objects are defined. They are called content types. The table in section Editing a Draft contains a list of the content types that mh-e currently knows about. Several of the mh-e commands fill in the content type for you, whereas others require you to enter one. Most of the time, it should be obvious which one to use (e.g., use `image/jpeg` to include a JPEG image). If not, you can refer to RFC 1521, (12) which defines the MIME protocol, for a list of valid content types.

You are also sometimes asked for a content description. This is simply an optional brief phrase, in your own words, that describes the object. If you don't care to enter a content description, just press return and none will be included; however, a reader may skip over multimedia fields unless the content description is compelling.

Remember: you can always add `mhn` directives by hand.

- Forwarding MIME
- FTP
- Tar
- Other MIME Objects
- Sending MIME

#### Forwarding multimedia messages

Mail may be forwarded with MIME using the command `C-c C-m C-f` (`mh-mhn-compose-forw`). You are prompted for a content description, the name of the folder in which the messages to forward are located, and the messages' numbers.

#### Including an ftp reference

You can even have your message initiate an `ftp` transfer when the recipient reads the message. To do this, use the `C-c C-m C-e` (`mh-mhn-compose-anon-ftp`) command. You are prompted for the remote host and pathname, the content type, and the content description.

#### Including tar files

If the remote file (see section Including an ftp reference) is a compressed tar file, you can use `C-c C-m C-t` (`mh-mhn-compose-external-compressed-tar`). Then, in addition to retrieving the file via anonymous ftp, the file will also be uncompressed and untarred. You are prompted for the remote host and pathname and the content description. The pathname should contain at least one ``/'` (slash), because the pathname is broken up into directory and name components.

#### Including other multimedia objects

Images, sound, and video can be inserted in your message with the `C-c C-m C-i` (`mh-mhn-compose-insertion`) command. You are prompted for the filename containing the object, the content type, and a content description of the object.

#### Readying multimedia messages for sending

When you are finished editing a MIME message, it might look like this:

       3  24Aug  root               received fax files on Wed Aug 24 11:00:13
       4+ 24Aug  To:wohler          Test<<This is a test message to get the wh

    --%%-{+inbox} 4 msgs (1-4)      (MH-Folder Show)--Bot-------------------
    To: wohler
    cc:
    Subject: Test of MIME
    --------
    #@application/octet-stream [Nonexistent ftp test file] \
    access-type=anon-ftp; site=berzerk.com; name=panacea.tar.gz; \
    directory="/pub/"
    #audio/basic [Test sound bite] /tmp/noise.au
    --**-{draft}      (MH-Letter)--All--------------------------------------

    mh-e MIME draft

The lines added by the previous commands are `mhn` directives and need to be converted to MIME directives before sending. This is accomplished by the command `C-c C-e` (`mh-edit-mhn`), which runs `mhn` on the message. The following screen shows what those commands look like in full MIME format. You can see why mail user agents are usually built to hide these details from the user.

    To: wohler
    cc:
    Subject: Test of MIME
    MIME-Version: 1.0
    Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
    Content-ID: <1623.777796162.0@newt.com>

    ------- =_aaaaaaaaaa0
    Content-Type: message/external-body; access-type="anon-ftp";
            site="berzerk.com"; name="panacea.tar.gz"; directory="/pub/"

    Content-Type: application/octet-stream
    Content-ID: <1623.777796162.1@newt.com>
    Content-Description: Nonexistent ftp test file

    ------- =_aaaaaaaaaa0
    Content-Type: audio/basic
    Content-ID: <1623.777796162.2@newt.com>
    Content-Description: Test sound bite
    Content-Transfer-Encoding: base64

    Q3JlYXRpdmUgVm9pY2UgRmlsZRoaAAoBKREBQh8AgwCAgH9/f35+fn59fX5+fn5+f39/f39/f3
    f4B/f39/f39/f39/f39/f39+f39+f39/f39/f4B/f39/fn5/f39/f3+Af39/f39/gH9/f39/fn
    -----{draft}      (MH-Letter)--Top--------------------------------------

    mh-e MIME draft ready to send

This action can be undone by running `C-c C-m C-u` (`mh-revert-mhn-edit`). It does this by reverting to a backup file. You are prompted to confirm this action, but you can avoid the confirmation by adding an argument (for example, `C-u C-c C-m C-u`).

### Sending a Message

When you are all through editing a message, you send it with the `C-c C-c` (`mh-send-letter`) command. You can give an argument (as in `C-u C-c C-c`) to monitor the first stage of the delivery.

### Killing the Draft

If for some reason you are not happy with the draft, you can kill it instead with `C-c C-q` (`mh-fully-kill-draft`). Emacs then kills the draft buffer and deletes the draft message.

## Moving Your Mail Around

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:

`i`
  Incorporate new mail into folder (`mh-inc-folder`).
`d`
  Delete message (`mh-delete-msg`).
`C-d`
  Delete message, don't move to next message (`mh-delete-msg-no-motion`).
`M-s`
  Find messages that meet search criteria (`mh-search-folder`).
`o`
  Output (refile) message to folder (`mh-refile-msg`).
`c`
  Copy message to folder (`mh-copy-msg`).
`C-o`
  Output (write) message to file (`mh-write-msg-to-file`).
`!`
  Repeat last output command (`mh-refile-or-write-again`).
`l`
  Print message with `lpr` (`mh-print-msg`).
`|`
  Pipe message through shell command (`mh-pipe-msg`).
`M-n`
  Unpack message created with `uudecode` or `shar` (`mh-store-msg`).
`M-l`
  List all folders (`mh-list-folders`).
`M-f`
  Visit folder (`mh-visit-folder`).
`M-r`
  Regenerate scan lines (`mh-rescan-folder`).
`M-x mh-sort-folder`
  Sort folder.
`M-p`
  Pack folder (`mh-pack-folder`).
`M-k`
  Remove folder (`mh-kill-folder`).
`x`
  Execute pending refiles and deletes (`mh-execute-commands`).
`u`
  Undo pending refile or delete (`mh-undo`).
`M-u`
  Undo all pending refiles and deletes (`mh-undo-folder`).
`q`
  Quit (`mh-quit`).

- Incorporating
- Deleting
- Organizing
- Printing
- Files and Pipes
- Finishing Up

### Incorporating Your Mail

If at any time you receive new mail, incorporate the new mail into your ``+inbox'` buffer with `i` (`mh-inc-folder`). Note that `i` will display the ``+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; you'll be prompted for the name of the file to use (for example, `C-u i ~/mbox `RET``).

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 mark a message for deletion, use the `d` (`mh-delete-msg`) 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 (see section Using Sequences) to delete (for example, `C-u d frombob RET`). The `x` command actually carries out the deletion (see section Finishing Up). `C-d` (`mh-delete-msg-no-motion`) marks the message for deletion but leaves the cursor at the current message in case you wish to perform other operations on the message.

### Organizing Your Mail with Folders

mh-e has analogies for each of the MH `folder` and `refile` commands. To refile a message in another folder, use the `o` (`mh-refile-msg`) (mnemonic: "output") command. You are prompted for the folder name.

If you are refiling several messages into the same folder, you can use the `!` (`mh-refile-or-write-again`) command to repeat the last refile or write (see the description of `C-o` in section Files and Pipes). Or, place the messages into a sequence (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` (`mh-copy-msg`) command (see the `-link` argument to `refile`(1)). 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` (`mh-visit-folder`) command to visit the folder. You are prompted for the folder name.

Other commands you can perform on folders include: `M-l` (`mh-list-folders`), to list all the folders in your mail directory; `M-k` (`mh-kill-folder`), to remove a folder; `M-x mh-sort-folder`, to sort the messages by date (see `sortm`(1) to see how to sort by other criteria); `M-p` (`mh-pack-folder`), to pack a folder, removing gaps from the numbering sequence; and `M-r` (`mh-rescan-folder`), to rescan the folder, which is useful to grab all messages in your ``+inbox'` after processing your new mail for the first time. 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` (`mh-print-msg`) (for line printer or lpr). The message is formatted with `mhl` and printed with the `lpr` 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` (`mh-write-msg-to-file`), 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 `|` (`mh-pipe-msg`) 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` or has been run through `uuencode` use `M-n` (`mh-store-msg`) 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` (`mh-undo`) 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` (`mh-undo-folder`) 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` (`mh-execute-commands`). Many mh-e commands that may affect the numbering 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` (`mh-quit`) command. This buries the buffers of the current mh-e folder 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.

## Searching Through Messages

You can search a folder for messages to or from a particular person or about a particular subject. In fact, you can also search for messages containing selected strings in any arbitrary header field or any string found within the messages. Use the `M-s` (`mh-search-folder`) command. You are first prompted for the name of the folder to search and then placed in the following buffer in MH-Pick mode:

    From: #
    To:
    Cc:
    Date:
    Subject:
    --------

    --**-Emacs: pick-pattern    (MH-Pick)------All----------------------------

    Pick window

Edit this template by entering your search criteria in an appropriate header field that is already there, or create a new field yourself. If the string you're looking for could be anywhere in a message, then place the string underneath the row of dashes. The `M-s` command uses the MH command `pick` to do the real work, so read `pick`(1) to find out more about how to enter the criteria.

There are no semantics associated with the search criteria--they are simply treated as strings. Case is ignored when all lowercase is used, and regular expressions (a la `ed`) are available. It is all right to specify several search criteria. What happens then is that a logical and of the various fields is performed. If you prefer a logical or operation, run `M-s` multiple times.

As an example, let's say that we want to find messages from Ginnean about horseback riding in the Kosciusko National Park (Australia) during January, 1994. Normally we would start with a broad search and narrow it down if necessary to produce a manageable amount of data, but we'll cut to the chase and create a fairly restrictive set of criteria as follows:

    From: ginnean
    To:
    Cc:
    Date: Jan 1994
    Subject: horse.*kosciusko
    --------

As with MH-Letter mode, MH-Pick provides commands like `C-c C-f C-t` to help you fill in the blanks.

`C-c C-f C-t`
  Move to ``To:'` header field (`mh-to-field`).
`C-c C-f C-c`
  Move to ``cc:'` header field (`mh-to-field`).
`C-c C-f C-s`
  Move to ``Subject:'` header field (`mh-to-field`).
`C-c C-f C-f`
  Move to ``From:'` header field (`mh-to-field`).
`C-c C-f C-b`
  Move to ``Bcc:'` header field (`mh-to-field`).
`C-c C-f C-f`
  Move to ``Fcc:'` header field (`mh-to-field`).
`C-c C-f C-d`
  Move to ``Dcc:'` header field (`mh-to-field`).
`C-c C-c`
  Execute the search (`mh-do-pick-search`).

To perform the search, type `C-c C-c` (`mh-do-pick-search`). The selected messages are placed in the search sequence, which you can use later in forwarding (see section Forwarding Mail), printing (see section Printing Your Mail), or narrowing your field of view (see section Using Sequences). Subsequent searches are appended to the search sequence. If, however, you wish to start with a clean slate, first delete the search sequence (how to do this is discussed in section Using Sequences).

If you're searching in a folder that is already displayed in a MH-Folder buffer, only those messages contained in the buffer are used for the search. Therefore, if you want to search in all messages, first kill the folder's buffer with `C-x k` or scan the entire folder with `M-r`.

## Using Sequences

For the whole scoop on MH sequences, refer to `mh-sequence`(5). As you've read, several of the mh-e commands can operate on a sequence, which is a shorthand for a range or group of messages. For example, you might want to forward several messages to a friend or colleague. Here's how to manipulate sequences.

`%`
  Put message in a sequence (`mh-put-msg-in-seq`).
`?`
  Display sequences that message belongs to (`mh-msg-is-in-seq`).
`M-q`
  List all sequences in folder (`mh-list-sequences`).
`M-%`
  Remove message from sequence (`mh-delete-msg-from-seq`).
`M-#`
  Delete sequence (`mh-delete-seq`).
`C-x n`
  Restrict display to messages in sequence (`mh-narrow-to-seq`).
`C-x w`
  Remove restriction; display all messages (`mh-widen`).
`M-x mh-update-sequences`
  Push mh-e's state out to MH.

To place a message in a sequence, use `%` (`mh-put-msg-in-seq`) to do it manually, or use the MH command `pick` or the mh-e version of `pick` (section Searching Through Messages) which create a sequence automatically. Give `%` a prefix argument and you can add all the messages in one sequence to another sequence (for example, `C-u % SourceSequence RET`).

Once you've placed some messages in a sequence, you may wish to narrow the field of view to just those messages in the sequence you've created. To do this, use `C-x n` (`mh-narrow-to-seq`). You are prompted for the name of the sequence. What this does is show only those messages that are in the selected sequence in the MH-Folder buffer. In addition, it limits further mh-e searches to just those messages. When you want to widen the view to all your messages again, use `C-x w` (`mh-widen`).

You can see which sequences a message is in with the `?` (`mh-msg-is-in-seq`) command. Or, you can list all sequences in a selected folder (default is current folder) with `M-q` (`mh-list-sequences`).

If you want to remove a message from a sequence, use `M-%` (`mh-delete-msg-from-seq`), and if you want to delete an entire sequence, use `M-#` (`mh-delete-seq`). In the latter case you are prompted for the sequence to delete. Note that this deletes only the sequence, not the messages in the sequence. If you want to delete the messages, use `C-u d` (see section Deleting Your Mail above).

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 section Viewing Your Mail for an example of how this command might be used.

With the exceptions of `C-x n` and `C-x w`, the underlying MH command dealing with sequences is `mark`.

## Miscellaneous Commands

One other command worth noting is `M-x mh-version`. Since there were a few changes in command letters between Versions 3 and 4, use this command to see which version you are running. This command didn't exist before Version 4, so the message ``[No match]'` indicates that it's time to upgrade (see section Getting mh-e). In the meantime, use the older commands that are listed in section Changes to mh-e. The output of `M-x mh-version` should also be included with any bug report you send (see section Bug Reports).

Go to the first, previous, next, last section, table of contents.