{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 command­line 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 mode­specific `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 fixed­pitch 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 Mode­Specific 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 preference­handling 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 built­in 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.
} {{{jdoc:anchor:anchorname {3.0 4.0 8.0 9.0 26.0 27.0 44.0 45.0 49.0 50.0 54.0 55.0 58.0 60.0}} {sel {6.61 6.68}} {jdoc:xref:link {4.15 4.20 30.276 30.296 45.251 45.269 52.55 52.80 55.1 55.16 56.1 56.16 67.122 67.137}} {jdoc:xref:manpage {4.58 4.60 36.65 36.69}} {richtext:font:roman {2.0 3.0 4.0 4.4 4.6 4.15 4.20 6.28 6.32 6.72 6.77 8.0 9.0 9.65 9.70 10.0 13.0 13.8 13.21 13.59 13.67 13.82 13.87 15.182 15.196 16.0 24.0 24.13 24.19 26.0 27.0 27.4 27.6 29.0 30.0 30.59 30.60 30.276 30.296 32.0 33.0 33.54 33.66 33.246 33.256 35.0 36.0 36.65 36.69 38.0 39.0 41.0 42.0 44.0 45.0 45.12 45.15 45.121 45.124 45.243 45.250 47.8 47.11 49.0 50.0 50.16 50.18 50.250 50.252 50.385 50.389 50.460 50.466 50.495 50.504 52.47 52.52 54.0 55.0 55.1 55.16 56.1 56.16 58.0 60.0 60.13 60.16 62.76 62.78 62.116 62.119 62.203 62.208 64.0 65.0 67.64 67.66 67.122 67.137 69.199 69.210 69.214 69.220 69.228 69.249 70.0}} {richtext:font:italic {50.385 50.389 50.495 50.504}} {richtext:font:bold {13.8 13.21 30.59 30.60 33.54 33.66 33.246 33.256 45.12 45.15 45.121 45.124 45.243 45.250 47.8 47.11 50.460 50.466 60.13 60.16 62.116 62.119 67.122 67.137}} {richtext:font:bolditalic {30.276 30.296 55.1 55.16 56.1 56.16}} {richtext:font:typewriter {4.4 4.6 4.15 4.20 6.28 6.32 6.72 6.77 9.65 9.70 10.0 13.0 13.59 13.67 13.82 13.87 15.182 15.196 16.0 24.0 24.13 24.19 27.4 27.6 36.65 36.69 50.16 50.18 50.250 50.252 52.47 52.52 62.76 62.78 62.203 62.208 67.64 67.66 69.199 69.210 69.214 69.220 69.228 69.249}} {richtext:font:heading0 {1.0 2.0}} {richtext:font:heading1 {3.0 4.0 8.0 9.0 26.0 27.0 44.0 45.0 49.0 50.0 54.0 55.0 58.0 59.0}} {richtext:font:heading2 {29.0 30.0 32.0 33.0 35.0 36.0 38.0 39.0 41.0 42.0 59.0 60.0 64.0 65.0}} {jdoc:anchorname:Introduction {3.0 4.0}} {jdoc:link:jedit.jdoc {4.15 4.20}} {jdoc:manpage:MH {4.58 4.60}} {jdoc:link:#Bugs_and_Misfeatures {30.276 30.296}} {jdoc:manpage:whom {36.65 36.69}} {jdoc:link:panels/prefs.jdoc {45.251 45.269}} {jdoc:anchorname:The_Tab_Key {44.0 45.0}} {jdoc:anchorname:Preferences {49.0 50.0}} {jdoc:link:jedit.jdoc#Mode­Specific_Preferences {52.55 52.80}} {jdoc:anchorname:See_Also {54.0 55.0}} {jdoc:anchorname:Evolution {58.0 59.0}} {jdoc:anchorname:Usage {8.0 9.0}} {jdoc:link:jeditmodes/mail-mode.jdoc {56.1 56.16}} {jdoc:link:jtagconvert.tcl.jdoc {67.122 67.137}} {jdoc:anchorname:The_MH_Menu_and_the_Buttonbar {26.0 27.0}} {jdoc:link:jeditmodes/exmh-mode.jdoc {55.1 55.16}} {jdoc:anchorname:Bugs_and_Misfeatures {59.0 60.0}}} {{abbrevstart 24.112} {matchend 38.13} {abbrevend 24.112} {insert 6.68} {anchor 6.68} {matchstart 38.7} {current 9.47}}} {}