6.7 Files and Pipes

MH-E does offer a couple of commands that are not a part of MH. The first one, > (mh-write-msg-to-file), writes a message to a file. 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 > /tmp/foobar RET). Subsequent writes to the same file can be made with the command ! (mh-refile-or-write-again).

You can also pipe the message through a Unix shell command with the command | (mh-pipe-msg). You are prompted for the Unix command through which you wish to run your message. If you give a prefix 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 X s (mh-store-msg) to extract the body of the message. The default directory for extraction is the current directory; however, 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. If you would like to change the initial default directory, customize the option mh-store-default-directory, change the value from ‘Current’ to ‘Directory’, and then enter the name of the directory for storing the content of these messages.

By the way, X s calls the Emacs Lisp function mh-store-buffer. I mention this because you can use it directly if you’re editing a buffer that contains a file that has been run through uuencode or shar. For example, you can extract the contents of the current buffer in your home directory by typing M-x mh-store-buffer RET ~ RET.