You may want to do more than an editor like vi or emacs can do to a draft message. For instance, you might want to start prompter on the new draft, then run a second editor to fill in the body. Or you might want to do something automatically each time a draft message is edited, like updating a mail message log. Or you could customize the way that a particular MH program, such as dist, handles a draft message. These are all good reasons to write a special editing shell script.
There are five things to know before you write your editor script:
Even if you don't run distprompter, it's a good example of what you can do with an MH draft editor. To run distprompter or another editor that you write, put an entry like this in your MH profile:
dist: -editor distprompterIf you write a more general purpose shell script editor for all the MH message composing programs, you can use an MH profile entry like this instead:
Editor: myeditorOne more note about editors: even though the mh-profile(5) and whatnow(1) manual pages have a lot of details, they don't explain an editor's environment or the effect of its exit status very thoroughly. I wrote this little test editor script that helped me learn. Maybe it'll help you:
#! /bin/sh echo The environment of $0: printenv echo "Command line had: '$*'" echo -n "Enter exit status for $0: " read stat exit $statRun it by typing, for example:
% comp -editor testedit
[Table of Contents] [Index] [Previous: Changing the MH Environment] [Next: Get Information with scan Format Strings]
This file is from the third edition of the book MH & xmh: Email for Users & Programmers, ISBN 1-56592-093-7, by Jerry Peek. Copyright © 1991, 1992, 1995 by O'Reilly & Associates, Inc. This file is freely-available; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. For more information, see the file copying.htm.
Suggestions are welcome: Jerry Peek <jerry@ora.com>
HIVE: All information for read only. Please respect copyright! |