# The `mh' Mode

## Introduction

The `mh` mode of `jedit` is intended for composing email with MH.

This document describes the `exmh` mode available with version 4.1/4.4 of `jedit`.

## Usage

If you only use MH on X workstations, and you always want to use `jedit` for composing MH mail messages, you can put
`repl: -ed jedit -mode mh
forw: -ed jedit -mode mh
comp: -ed jedit -mode mh
` in your ~/.mh_profile. (You may be able to leave off the ``-mode mh`' parts, since `jedit` will usually guess correctly that you're editing an MH draft, based on the pathname.)

However, this will break using MH when you don't have an X display available, unless you override it with an explicit commandline flag. I actually use a little shell script I call `generic-editor`, whose contents are the following
`#!/bin/sh
# generic-editor - start up an appropriate editor
if [ ${DISPLAY:-NONE} = "NONE" ]
then
exec /usr/local/bin/emacs "$@"
else
exec /usr/local/bin/jedit "$@"
fi
` and I set my `EDITOR` environment variable to that. (Obviously, this could be made more elaborate; for instance, at one time I had it checking whether I was running under NextStep, too.)

## The MH Menu and the Buttonbar

The `mh` mode provides a modespecific `MH' menu and buttonbar. The buttonbar duplicates the commands on the menu (with terser names); what I say here about the menu commands also applies to the buttons.

### Start Reply

The `Start Reply' command inserts the contents of the file @ in the current directory at the end of the message. (By MH convention, this should contain the message you're replying to.) The header is stripped from the file, and it's indented to indicate it's a reply. (See Bugs and Misfeatures.)

### Sign Email

The `Sign Email' command inserts the contents of your ~/.signature file at the bottom of your mail. (The signature is automatically inserted in a fixedpitch font, in case you normally use a proportional font and you have ASCII graphics in your .signature, not that I recommend that practise. :-)

### List Recipients

The `List Recipients' command saves your message and runs the MH `whom`(1) command on it, displaying the output. This can sometimes be useful in identifying typos in email addresses.

### Insert Border

The `Insert Border' command inserts a row of spaced asterisks into your message. I sometimes use this when forwarding mail or copying snippets of files or a screen dump into mail.

### Done

The `Done' command from the `Editor' menu is duplicated on the buttonbar for convenience, and on the `MH' menu for consistency.

## The Tab Key

Hitting the Tab key while typing in your message takes you the first header field, whose contents are selected. Hitting Tab again (not too quickly!) will cycle through the header fields. If you have `Typing replaces selection' chosen on the jstools Global Preferences panel, this lets you easily fill in the header fields of your message.

Hitting Tab twice quickly, or hitting it when the last header field is selected, takes you directly to the end of your text.

## Preferences

By default, the `mh` mode displays breaks in long lines at character boundaries rather than just at word boundaries; this makes it a little easier to see if you have a line that's too long for email (assuming your window itself isn't too wide). Also, `mh` mode will automatically insert newlines for you as you approach the right margin. (There are two different concepts here - whether real newlines are inserted, creating a new line even if you didn't hit the Return key, and how long lines are displayed on the screen. When you're composing email, it's a good idea not to let your lines get any longer than about 72 characters.)

Of course, you can change these preferences on `jedit`'s ModeSpecific Preferences panel.

## See Also

The `exmh' Mode
The `mail' Mode

## Evolution

### Bugs and Misfeatures

* Hardcoding Tab to jump to the header fields makes it hard to use dynamic abbreviations (or tabs, for that matter!).

* My quirky indentation style for quoting text should not be hardwired into `mh` mode! This (and possibly the use of Tab to jump to the headers) should be a user preference; that would require changes to `jedit`'s mode and preferencehandling mechanisms.

### Future Directions

* I hope to add creeping features.

* I'd like to add MIME support, either based on Brent's code in `mh`'s builtin editor, or based on similar code to that in jtagconvert.tcl.

* I'd like to put the headers on their own panel, separate from the body of the message. Of course, I'd want to do this in a sufficiently general way not to prevent people from adding headers like ``Precedence:`', ``X-Face`:', or ``X-Opcode-of-the-Week:`' if they choose.
`
`