# The `exmh' Mode

## Introduction

The `exmh` mode of `jedit` is intended for composing email in conjunction with Brent Welch `<welch@parc.xerox.com>`'s excellent `exmh` mail reader, itself built upon MH. When you're done composing your mail, the `exmh` mode communicates with the running copy of `exmh` that invoked it, causing `exmh` to pop up its confirmation panel and (if you so choose) send your mail.

This document describes the `exmh` mode available with version 4.0/4.0b of `jedit`.

## Usage

To use `exmh` mode, set your editor to ``jedit -mode exmh -for &`' in `exmh`'s `Editor Preferences' panel (accessed from the `Preferences' button). `exmh` will strip off the ampersand and add its own name and then the name of the draft mail message file after the ``-for`' argument, and run `jedit` in the background.

When you tell `jedit` you're done with the message (by choosing `Done' or `Quit'), `jedit` will send the command ``EditDialog` filename' to `exmh`, where filename is the name of the draft message file. That tells `exmh` to bring up the `What Now?' panel asking whether you want to send the message.

## The MH Menu and the Buttonbar

The `exmh` 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 `exmh` 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, `exmh` 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 `mh' 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 `exmh` mode! This (and possibly the use of Tab to jump to the headers) should be a user preference; that will 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 `exmh`'s builtin editor, or based on code similar 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.

``