MH-DRAFT(5mh)
π MH-DRAFT(5mh) β the mh-draft glow-up π
okay bestie, sit down, hydrate, because we're about to talk about mh-draft, aka the draft folder facility for the nmh message system. this is the lore behind how you compose outgoing mail like a main character instead of like a gremlin. π
β¨ DESCRIPTION β¨
so there are a number of interesting advanced facilities for the composition of outgoing mail. iconic behaviour. let's get into it.
ποΈ The Draft Folder ποΈ
the commands comp, dist, forw, repl, send, and whom β yes, all six, they're a friend group β each take the switches -draftfolder +folder and -draftmessage msg, which let you manipulate the various draft messages you're composing. it's giving draft management era. π
- if
-draftfolder +folderis used, draft messages will be constructed in the indicated folder. theDraft-Folderprofile entry may be used to specify a default draft folder. - if the switch
-draftmessage msgis given, the specified draft is used to compose the message. if-draftmessage msgis not used, then the draft defaults tonew(create a new draft) β unless the user invokescompwith-use, in which case the default iscur.
so basically the user may have several message compositions in progress simultaneously. multitasking queen. and now, all of the nmh tools are available on each of the user's message drafts (e.g. show, scan, pick, and so on). if the folder does not exist, the user is asked if it should be created (just like with refile). the last draft message the user was composing is known as cur in the draft folder. π
using send, the user can send drafts using the standard nmh msgs convention with -draftmessage msgs. if no msgs are given, it defaults to cur.
in addition, all of these programs have a -nodraftfolder switch, which undoes the last occurrence of -draftfolder folder β super useful if a default is specified in the user's nmh profile. the way it just undoes the thing. π«Ά
if the user does not give the -draftfolder +folder switch, then all these commands act "normally". note that the -draft switch to send and show still refers to the file called draft in the user's nmh directory. in the interests of economy of expression, when using comp or send, the user needn't prefix the draft msg or msgs with -draftmessage. both of these commands accept a file or files argument and they will, if given -draftfolder +folder, treat these arguments as msg or msgs. (this may appear to be inconsistent, at first, but it saves a lot of typing. and honestly? we respect the hustle.) hence,
send -draftfolder +drafts first
is the same as
send -draftfolder +drafts -draftmessage first
to make all this a bit more clear, here are some examples. let's assume that the following entries are in the nmh profile:
Draft-Folder: drafts
sendf: -draftfolder +drafts
furthermore, let's assume that the program sendf is a (symbolic) link in the user's $HOME/bin/ directory to send. okay so now,
comp
dist
forw
repl
will construct the message draft in the drafts folder using the new message number. furthermore, they each define cur in this folder to be that message draft. π«
if the user were to use the quit option at the What now? prompt, then later on, if no other draft composition was done, the draft could be sent with simply
sendf
or, if more editing was required, the draft could be edited with
comp -use
if other drafts had been composed in the meantime, so that this message draft was no longer known as cur in the draft folder, then the user could scan the folder to see which message draft should be used for editing or sending. clever users could even employ a backquoted pick to do the work:
comp -use `pick +drafts -to nmh-workers`
or
sendf `pick +drafts -to nmh-workers`
note that in the comp example, the output from pick must resolve to a single message draft β it makes no sense to talk about composing two or more drafts with one invocation of comp. not me trying to compose two drafts at once π. in contrast, in the send example, as many message drafts as desired can appear, since send doesn't mind sending more than one draft at a time. she's flexible like that. π
note that the argument -draftfolder +folder is not included in the profile entry for send, since when comp, et al, invoke send directly, they supply send with the Unix pathname of the message draft; not a -draftmessage msg argument. as far as send is concerned, a draft folder is not being used. lowkey a whole plot twist.
it is important to realize that nmh treats the draft folder like a standard nmh folder in nearly all respects. there are two exceptions:
- first, under no circumstances will the
-draftfolder folderswitch cause the named folder to become the current folder. obviously, if the folder appeared in the context of a standard+folderargument to an nmh program, as in
scan +drafts
it might become the current folder, depending on the context changes of the nmh program in question.
- second, although conceptually
senddeletes themsgsnamed in the draft folder, it does not calldelete-progto perform the deletion. noted. π
π³ What Happens if the Draft Exists π³
when the comp, dist, forw, and repl commands are invoked and the draft you indicated already exists, these programs will prompt the user for a response directing the program's action. the prompt is
Draft "/home/foobar/nmhbox/draft" exists (xx bytes).
Disposition?
the appropriate responses and their meanings are:
replaceβ deletes the draft and starts afreshlistβ lists the draftrefileβ files the draft into a folder and starts afreshquitβ leaves the draft intact and exits
in addition, if you specified -draftfolder folder to the command, then one other response will be accepted:
newβ creates a new draft
just as if -draftmessage new had been given. finally, the comp command will accept one more response:
useβ re-uses the draft
just as if -use had been given. periodt. πΈ
π FILES π
$HOME/.mh_profileβ the user's profile.
π PROFILE COMPONENTS π
Draft-Folder:β for a default draft folder
π CONTEXT π
none. empty. not a single context to be found. ghosted. π¦
heads up bestie: this is the5mhmanual formh-draft, part of the nmh-1.8 release, dated 2012-03-18. go forth and compose your drafts like the icon you are. no cap. πβ¨
π¦ where this page comes from
- debian trixie: nmh 1.8-3
- ubuntu noble: nmh 1.8-1build4
- ubuntu questing: nmh 1.8-3
- ubuntu resolute: nmh 1.8-4
- ubuntu stonking: nmh 1.8-4build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms