# Using Another Editor
by Brent Welch

You can use your favorite editor with exmh by specifying an `Editor command` in the `Editor Support` preferences section. The absolute pathname of the draft message will be appended as the command is executed or be inserted before the `&`. Several examples of editor commands include:

        sedit
        mxedit
        tkvi &
        emacsclient &
        exmh-async emacs
        exmh-async emacsclient
        exmh-async xterm -e vi

The built-in editor is called sedit. Mxedit and tkvi are Tcl-based editors that know how to communicate with exmh about draft messages. emacsclient is a program that communicates with a running emacs to have it edit a specified file. To set up your Emacs as a server for this arrangement, you'll need the Emacs server.el package. The misc directory of the exmh distribution has more information. emacsclient can be used in two ways. If you can post the message directly from Emacs, then use `emacsclient &`; exmh will assume that emacs will handle the draft. Otherwise, use the exmh-async wrapper that is described below.

After the editor exits you are presented with a `What Now` dialog that gives you several options: `Send`, `Abort`, `Save`, `Re-edit`, and `More...`. Under the `More...` menu you can apply MHN, run a spell checker, or run the MH whom program to verify the addresses you have specified. You can also invoke the built-in editor, sedit, which has MIME composition features.

You'll normally use the exmh-async wrapper script to run an external editor. It's a short Tcl/Tk script that runs your editor and then communicates with exmh when your editor exits. This means the exmh user interface can remain active while you compose your message. You can even compose several messages at once. You'll get a different `What Now` dialog for each message draft.

The exmh-async wrapper tries to pass through all the arguments to the editor command you specify. A couple of arguments are picked up by the Tcl/Tk shell (wish). However, you can protect arguments with curly braces `{ }`. For example, the following passes the arguments `-geo 80x40+0+0` to xterm and `+/[-]*$` to vi:

        exmh-asyc xterm {-geo 80x40+0+0} -e {vi +/[-]*$}

The braces protect the `-geo` argument from exmh-async, and it protects the complex format of the vi search command from interpretation by the Tcl parser.

As a final note, if you try to test exmh-async from the command line, you need to execute it like this:

        exmh-async exmh xterm -e vi &

The first argument is the name of the exmh application. It's needed for the Tk-based communication between exmh-async and exmh. This argument does not appear when you define the command in preferences.