Part of the Section about forw, Formatting the Header, gives an overview of this script. Here is the forwedit script (you might want to open it in a separate browser window). To install it, first see the Section Programs in This Book's Archive and create the file forwedit. If you've grabbed the archive file, you'll probably also want to extract the hard link, forwbatch, to the file. Just give tar both names and it will create the link automatically. Otherwise, make the link with ln.
The forwedit link is for people who want to run an interactive editor after the header is created. The default editor is prompter, but you can change it by putting an entry like this in your MH profile:
forwedit: -editor vi(Note that forwedit doesn't accept the -editor switch on its command line. It only checks the MH profile.)
If you're using a front-end like exmh that does its own editing of the header, you'll want add -editor forwbatch to the forw: MH profile entry. For plain MH, add -editor forwedit instead.
By default, this script makes the Subject: of the draft the same as that of the message you're forwarding, plus (fwd) at the end. If you're forwarding more than one message, it uses the subject Forwarded Messages. You can change the way this works by editing the lines that set the draftsubj shell variable.
There's one trick here: Because of the way MH works, the script can only tell how many messages you're forwarding (one or multiple) by reading the mhmessages environment variable. And that variable is only set if you're using the forw -annotate switch. Otherwise, the script sets the forwarded subject by scanning the current message. (The alternative was to write a front-end script that grabs the message numbers and eventually starts the real forw. This got pretty messy with MH interfaces like exmh.)
When forw calls its editor (this script), forw passes the pathname of the draft file that it's constructed. After this script has decided on the new subject line, it calls the UNIX ed editor to change the Subject: field in the draft. Then, if you've invoked the script as forwedit, it calls its interactive editor to let you finish the draft. Or, forwbatch simply exits, leaving the draft for forw to handle. For more info on this process, see the section Overview: Sending MH Messages.
This file first appeared in the updated online edition of the book MH & nmh: Email for Users & Programmers, by Jerry Peek. It 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 COPYING.
Copyright © 1997 Jerry Peek
Last modified: 2006-05-31 15:13:43 -0700