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

Tour Through mh-e

This chapter introduces some of the terms you'll need to know and then takes you on a tour of mh-e. (2) When you're done, you'll be able to send, read, and file mail, which is all that a lot of people ever do. But if you're the curious type, you'll read section Using mh-e to be able to use all the features of mh-e. If you're the adventurous type, you'll read section Customizing mh-e to make mh-e do what you want. I suggest you read this chapter first to get the big picture, and then you can read the other two as you wish.

GNU Emacs Terms and Conventions

If you're an experienced Emacs user, you can skip the following conventions and definition of terms and go directly to section Getting Started below. The conventions are as follows:

C-x
Hold down the CTRL (Control) key and press the x key.
M-x
Hold down the META or ALT key and press the x key. Since some keyboards don't have a META key, you can generate M-x, for example, by pressing ESC (Escape), releasing it, (3) and then pressing the x key.
RET
Press the RETURN or ENTER key. This is normally used to complete a command.
SPC
Press the space bar.
TAB
Press the TAB key.
DEL
Press the DELETE key. This may also be a Backspace key, depending on your keyboard or Emacs configuration.

A prefix argument allows you to pass an argument to any Emacs function. To pass an argument, type C-u before the Emacs command or keystroke. Numeric arguments can be passed as well. For example, to insert five f's, use C-u 5 f. There is a default of four when using C-u, and you can use multiple prefix arguments to provide arguments of powers of four. To continue our example, you could insert four f's with C-u f, 16 f's with C-u C-u f, 64 f's with C-u C-u C-u f, and so on. Numeric and valueless negative arguments can also be inserted with the META key. Examples include M-5 to specify an argument of 5, or M-- which specifies a negative argument with no particular value.

NOTE

The prefix C-u or M- is not necessary in mh-e's MH-Folder modes (see section Receiving Mail). In these modes, simply enter the numerical argument before entering the command.

There are several other terms that are used in Emacs that you should know. The point is where the cursor currently is. You can save your current place in the file by setting a mark. This operation is useful in several ways. The mark can be later used when defining a region, which is the text between the point and mark. Many commands operate on regions, such as those for deleting text or filling paragraphs. A mark can be set with C-@ (or C-SPC).

The minibuffer is the bottom line of the Emacs window, where all prompting and multiple-character input is directed. If you are prompted for information in the minibuffer, such as a filename, Emacs can help you complete your answer if you type SPC or TAB. A second SPC or TAB will list all possibilities at that point. The minibuffer is also where you enter Emacs function names after typing M-x. For example, in the first paragraph, I mentioned that you could obtain help with C-h t (help-with-tutorial). What this means is that you can get a tutorial by typing either C-h t or M-x help-with-tutorial. In the latter case, you are prompted for `help-with-tutorial' in the minibuffer after typing M-x.

In case of trouble: Emacs can be interrupted at any time with C-g. For example, if you've started a command that requests that you enter something in the minibuffer, but then you change your mind, type C-g and you'll be back where you started. If you want to exit Emacs entirely, use C-x C-c.

Getting Started

Because there are many old versions of mh-e out there, it is important to know which version you have. I'll be talking about Version 5 which is similar to Version 4 and vastly different from Version 3.

First, enter M-x load-library RET mh-e RET. (4) The message, `Loading mh-e...done', should be displayed in the minibuffer. If you get `Cannot open load file: mh-e', then your Emacs is very badly configured, or mh-e is missing. You may wish to have your system administrator install a new Emacs or at least the latest mh-e files.

Having loaded mh-e successfully, enter M-x mh-version RET. The version of mh-e should be displayed. Hopefully it says that you're running Version 5.0.2 which is the latest version as of this printing. If instead Emacs beeps and says `[No match]', then you're running an old version of mh-e.

If these tests reveal a non-existent or old version of mh-e, please consider obtaining a new version. You can have your system administrator upgrade the system-wide version, or you can install your own personal version. It's really quite easy; instructions for getting and installing mh-e are in section Getting mh-e. In the meantime, see section Changes to mh-e, which compares the old and new names of commands, functions, variables, and buffers.

Also, older versions of mh-e assumed that you had already set up your MH environment. Newer versions set up a new MH environment for you by running install-mh and notifying you of this fact with the message in a temporary buffer:

I'm going to create the standard MH path for you.

Therefore, if you've never run MH before and you're using an old version of mh-e, you need to run install-mh from the shell before you continue the tour. If you don't, you'll be greeted with the error message: `Can't find MH profile'.

If, during the tour described in this chapter, you see a message like: `Searching for program: no such file or directory, /usr/local/bin/mhpath', it means that the MH programs and files are kept in a nonstandard directory. In this case, simply add the following to `~/.emacs' and restart emacs.

(setq mh-progs "/path/to/MH/binary/directory/")
(setq mh-lib "/path/to/MH/library/directory/")

The `~' notation used by `~/.emacs' above represents your home directory. This is used by the bash and csh shells. If your shell does not support this feature, you could use the environment variable `$HOME' (such as `$HOME/.emacs') or the absolute path (as in `/home/wohler/.emacs') instead.

At this point, you should see something like the screen in the figure in section Receiving Mail. We're now ready to move on.

Sending Mail

Let's start our tour by sending ourselves a message which we can later read and process. Enter M-x mh-smail to invoke the mh-e program to send messages. You will be prompted in the minibuffer by `To:'. Enter your login name. The next prompt is `cc:'. Hit RET to indicate that no carbon copies are to be sent. At the `Subject:' prompt, enter Test or anything else that comes to mind.

Once you've specified the recipients and subject, your message appears in an Emacs buffer whose mode (5) is MH-Letter. Enter some text in the body of the message, using normal Emacs commands. You should now have something like this: (6)


-----Emacs: *scratch*         (Lisp Interaction)--All---------------------
To: wohler
cc:
Subject: Test
--------
  This is a test message to get the wheels churning...#

--**-{draft}      (MH-Letter)--All----------------------------------------

mh-e message composition window

Note the line of dashes that separates the header and the body of the message. It is essential that these dashes (or a blank line) are present or the body of your message will be considered to be part of the header.

There are several commands specific to MH-Letter mode, but at this time we'll only use C-c C-c to send your message. Type C-c C-c now. That's all there is to it!

Receiving Mail

To read the mail you've just sent yourself, enter M-x mh-rmail. This incorporates the new mail and put the output from inc (called scan lines after the MH program scan which prints a one-line summary of each message) into a buffer called `+inbox' whose major mode is MH-Folder.

NOTE

The M-x mh-rmail command will show you only new mail, not old mail. If you were to run this tour again, you would use M-r to pull all your messages into mh-e.

You should see the scan line for your message, and perhaps others. Use n or p to move the cursor to your test message and type RET to read your message. You should see something like:

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

--%%-{+inbox} 4 msgs (1-4)      (MH-Folder Show)--Bot---------------------
To: wohler
Subject: Test
Date: Wed, 24 Aug 1994 13:01:13 -0700
From: Bill Wohler <wohler@newt.com>

  This is a test message to get the wheels churning...

-----{show-+inbox} 4      (MH-Show)--Bot----------------------------------

After incorporating new messages

If you typed a long message, you can view subsequent pages with SPC and previous pages with DEL.

Processing Mail

The first thing we want to do is reply to the message that we sent ourselves. Ensure that the cursor is still on the same line as your test message and type r. You are prompted in the minibuffer with `Reply to whom:'. Here mh-e is asking whether you'd like to reply to the original sender only, to the sender and primary recipients, or to the sender and all recipients. If you simply hit RET, you'll reply only to the sender. Hit RET now.

You'll find yourself in an Emacs buffer similar to that when you were sending the original message, like this:

To: wohler
Subject: Re: Test
In-reply-to: Bill Wohler's message of Wed, 24 Aug 1994 13:01:13 -0700
             <199408242001.NAA00505@newt.com>
--------
#

--**-{draft}      (MH-Letter)--All----------------------------------------
To: wohler
Subject: Test
Date: Wed, 24 Aug 1994 13:01:13 -0700
From: Bill Wohler <wohler@newt.com>

  This is a test message to get the wheels churning...

-----{show-+inbox} 4      (MH-Show)--Bot----------------------------------
Composing a reply...done
Composition window during reply

By default, MH will not add you to the address list of your replies, so if you find that the `To:' header field is missing, don't worry. In this case, type C-c C-f C-t to create and go to the `To:' field, where you can type your login name again. You can move around with the arrow keys or with C-p (previous-line), C-n (next-line), C-b (backward-char), and C-f (forward-char) and can delete the previous character with DEL. When you're finished editing your message, send it with C-c C-c as before.

You'll often want to save messages that were sent to you in an organized fashion. This is done with folders. You can use folders to keep messages from your friends, or messages related to a particular topic. With your cursor in the MH-Folder buffer and positioned on the message you sent to yourself, type o to output (refile in MH parlance) that message to a folder. Enter test at the `Destination:' prompt and type y (or SPC) when mh-e asks to create the folder `+test'. Note that a `^' (caret) appears next to the message number, which means that the message has been marked for refiling but has not yet been refiled. We'll talk about how the refile is actually carried out in a moment.

Your previous reply is now waiting in the system mailbox. You incorporate this mail into your MH-Folder buffer named `+inbox' with the i command. Do this now. After the mail is incorporated, use n or p to move the cursor to the new message, and read it with RET. Let's delete this message by typing d. Note that a `D' appears next to the message number. This means that the message is marked for deletion but is not yet deleted. To perform the deletion (and the refile we did previously), use the x command.

If you want to send another message you can use m instead of M-x mh-smail. So go ahead, send some mail to your friends!

Leaving mh-e

You may now wish to exit emacs entirely. Use C-x C-c to exit emacs. If you exited without running x in the `+inbox' buffer, Emacs will offer to save it for you. Type y or SPC to save `+inbox' changes, which means to perform any refiles and deletes that you did there.

If you don't want to leave Emacs, you can type q to bury (hide) the mh-e folder or delete them entirely with C-x k. You can then later recall them with C-x b or M-x mh-rmail.

More About mh-e

These are the basic commands to get you going, but there are plenty more. If you think that mh-e is for you, read section Using mh-e and section Customizing mh-e to find out how you can:

Remember that you can also use MH commands when you're not running mh-e (and when you are!).


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