If you use the quit command at a What now? prompt, it leaves the draft message for you to work on later.
MH also has a very useful feature called draft folders that lets you keep many draft messages, work on them, and send them "in the background" while you do something else. This section explains how to work with draft messages in MH.
Draft '/yourMHdir/draft' exists; disposition?Press RETURN for a list of what you can do. Here are the choices:
You can also get here directly and skip the disposition? prompt by starting with the command:
% comp -useThat's the normal way to re-edit an existing draft message.
NOTE: If you're re-editing a draft that you started with repl, forw, or dist and its -annotate switch, the original message won't be annotated. That's because there's no way for MH to find the original message number just by looking at the leftover draft. You can annotate the message yourself with anno.
What now? pushto send your messages, you don't have to wait to start a new message until the previous draft has been sent. This is because push doesn't process the draft right away -- it takes a few seconds, especially on a busy computer. Without a draft folder, with only one draft file, the draft exists until it's been sent. A draft folder avoids this problem by letting push take its time sending a draft while you work on a new draft.
To set up a draft folder, you may want to skip ahead and read about folders. Once you've set up a draft folder, though, you don't need to think about folders much. Here's how you do it:
% folder -push +drafts Folder /yourMHdir/drafts doesn't exist; create? y drafts+ has no messages. % folder -pop [previousfolder+ now current.]
Draft-folder: drafts
What now? q whatnow: draft left on /yourMHdir/drafts/1That shows that the draft message is number 1. Then start another draft (with comp or repl or...). Instead of the old prompt:
Draft '/yourMHdir/draft' exists; disposition?MH will give you a fresh draft. Then, if you type quit again, you'll see that this new draft has the next higher message number in the draft folder:
What now? q whatnow: draft left on /yourMHdir/drafts/2How do you finish a draft that you've left in the draft folder? An easy way is with the following command:
% comp -use nwhere n is the draft message number that you want to resume. Easier: if you want to re-edit the draft you started most recently, that draft should still be the current message in the draft folder... in which case you can omit the message number n.
If you're not sure which message you want, you can scan the draft folder to get a summary of your draft messages:
% scan +draftsOr, the recomp shell script is probably the easiest way of all.
As explained in the Section Single Draft Messages, if you're re-editing a draft that you started with repl, forw, or dist and its -annotate switch, the original message won't be annotated.
If you type quit -delete at a What now? prompt -- or, if your editor program returns a nonzero exit status to whatnow (see the Section Aborted Draft Messages) -- whatnow will delete your draft as explained above. When that happened, versions of MH before 6.7.2 just said that the draft was "deleted." MH 6.7.2 changed the message to a user-friendly:
whatnow: problems with edit -- draft left in /yourMHdir/drafts/,2
If you use an editor like that, find out whether your version of MH was built with the [ATTVIBUG] configuration option. If you can't use [ATTVIBUG], you can make a shell script like the one below, myvi, that edits the draft and always returns a zero exit status.
Example: Workaround for vi editor problem: myvi
#! /bin/sh # myvi - workaround for "vi" that returns non-zero exit status # and makes MH "whatnow" delete draft message. # Usage (in MH profile) Editor: myvi vi $* exit 0To install myvi, see the Section Writing Shell Scripts for MH and the Section Changing Default Editors. The Section Writing Your Own Draft Message Editor(s) explains more about writing draft editors.
The recomp script helps with that. If you give it a message number in the draft folder, it starts comp -use on that message with your favorite editor program. Without a message number, recomp scans the draft folder, then lets you enter the number of the message you want to recompose, and then starts comp -use. When you exit your editor, you get the usual What now? prompt.
Another section shows how to set up recomp.
$ scandrafts -stay Draft message(s) you've already sent: ,1:Subject: Re: SC or GA islands ,5:Subject: Re: our previous message about banners dialups ,6:Subject: Re: Can you help? ,7:Subject: Out this morning To get them back, use 'mv'. =========================================================== Draft message(s) you haven't sent: 1 03/07*To:alison@mvus.cs Project status<<Alison, the scan: message 2: empty 3+ 03/07*To:kx9cq@cornell. Scientific Visualization Dem You'll be in a /bin/ksh shell in the +drafts folder To quit, type control-d. scandrafts> rmm 2 scandrafts> mv ,6 6 scandrafts> scan 1 03/07*To:alison@mvus.cs Project status<<Alison, the p 3+ 03/07*To:kx9cq@cornell. Scientific Visualization Demo 6 03/04*To:"Warren Z. Von Re: Can you help?<<Warren, yo scandrafts> refile 6 +outbox scandrafts> CTRL-D [folder +inbox now current] $First, you see four messages that have already been sent. The send program put commas at the beginnings of their names. Next come the messages that haven't been sent. One draft is empty (this can happen if you have trouble composing a message).
Then, because the -stay switch was used, scandrafts starts the default shell (this person uses the Korn shell). The shell prompt is set to scandrafts>. The current folder and current directory are the draft folder, so rmm removes the empty draft and mv takes the comma off message 6. A scan shows the cleaned-up folder. CTRL-D ends the shell and the scandrafts script.
Another section explains how to set up scandrafts.
What now? edit mhnbut that step can be easy to forget. If you forget, the recipient will get a message full of your directives -- instead of the encoded MIME message you meant to send. If you want all the messages you send to be MIME messages, you can run mhn automatically. Add this entry to your MH profile:
automhnproc: mhnThen, when you type send or push at the What now? prompt, mhn will run automatically.
The automhnproc isn't right for everyone. If you send drafts that have lines starting with a hash mark (#) which aren't directives, mhn will complain about an "unknown directive." You'll have to edit the message and change the non-directive lines starting with # to start with ## instead. Also, after you have some MIME experience, you may not always agree with the encoding that mhn chooses. If you don't use the automhnproc, you can edit the encoded draft and change the encoding.
In cases like those, you have a few choices. One is to remember to run mhn by hand when you need it. Another is to add this header field to your draft:
MIME-Version: 1.0When send sees that field, it won't invoke the automhnproc. But if you add that field, be sure that your message really is in legal MIME format! (There are too many bogus MIME messages already.)
Let's start this example by sending a message:
What now? edit mhn What now? list ...message appears; you see mistake...Use these steps to recover the original directives:
What now? quit whatnow: draft left on /mh/jerry/drafts/3
Here are examples with a draft folder and without. Use backquotes (`), not single quotes ('), in the commands below. The command ls -lt lists the most recently modified files first.
With a draft folder:
% cd `mhpath +drafts` % ls -lt total 357 ... -rw------- 1 jerry 86340 Oct 16 10:46 3 -rw------- 1 jerry 1419 Oct 16 10:43 ,3.orig ...No draft folder:
% cd `mhpath +` % ls -lt total 289 ... -rw------- 1 jerry 86340 Oct 16 10:46 draft -rw------- 1 jerry 1419 Oct 16 10:43 ,draft.orig ...
% mv ,3.orig 3
What now? edit mhn What now? list ...oops... What now? edit original What now? edit viThe original draft, with directives, will open inside your editor. You can fix the problem, save the file, quit the editor, and then type edit mhn again. Here's how to install original.
[Table of Contents] [Index] [Previous: Header Fields and Addresses] [Next: Composing and Sending MIME Messages]
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! |