Explanation of recomp

[previous] [next] [table of contents] [index]

The Section Work on Draft Folder: scandrafts gives an overview of this script. Here is the recomp script (you might want to open it in a separate browser window). To install it, see the Section Programs in This Book's Archive.

To make recomp run more quickly, the draft folder name is stored in the draftf shell variable. If more than one person is running recomp, you should replace that hardcoded folder name with a call to mhparam or mhprofile. The following code will call mhparam to set the right draft folder for everyone -- and exit if there's trouble:

draftf="+`mhparam draft-folder`" || {
    echo "`basename $0`: quitting: trouble finding your draft folder." 1>&2
    exit 1
}
The folopts variable stores command-line switches for folder that override any undesirable switches in the user's MH profile. This is important because, for instance, folder: -pack in the MH profile would renumber the draft messages -- but the user wouldn't be expecting that here. You shouldn't always override MH profile switches this way. For example, changing the output format of the scan command in this script can't hurt much; as a matter of fact, users would probably appreciate having the scan output they're used to seeing...

The script calls comp -use -editor xxx to edit the draft message, where xxx is one of several editors. In order to choose the editor, several nested Bourne shell ${varname-default} operators check the VISUAL, EDITOR and EDIT environment variables; if none are set, the script defaults to vi.

The stat shell variable holds the script's exit status. It's set to 1 (indicating an error) at the start of the script. If the script finishes, stat is set to 0 (assuming that comp returned 0, that is). The trap sets the script's exit value as the script ends.

[Table of Contents] [Index] [Previous: Explanation of rcvsearch] [Next: Explanation of resend]


Revised by Jerry Peek. Last change $Date: 1999/10/10 05:14:05 $

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 <jpeek@jpeek.com>