]> diplodocus.org Git - nmh/blob - man/mh-draft.man
lock_file.c: close(2) file descriptor on failure, avoiding leak.
[nmh] / man / mh-draft.man
1 .TH MH-DRAFT %manext5% 2012-03-18 "%nmhversion%"
2 .
3 .\" %nmhwarning%
4 .
5 .SH NAME
6 mh-draft \- draft folder facility for nmh message system
7 .SH DESCRIPTION
8 There are a number of interesting advanced facilities for the composition of
9 outgoing mail.
10 .SS "The Draft Folder"
11 The
12 .BR comp ,
13 .BR dist ,
14 .BR forw ,
15 .BR repl ,
16 .BR send ,
17 and
18 .B whom
19 commands each take the switches
20 .B \-draftfolder
21 .I +folder
22 and
23 .B \-draftmessage
24 .IR msg ,
25 which allow you to manipulate the various draft messages you are composing.
26 .PP
27 If
28 .B \-draftfolder
29 .I +folder
30 is used, draft messages will be constructed in the indicated folder. The
31 .RI \*(lq Draft\-Folder \*(rq
32 profile entry may be used to specify a default draft folder.
33 .PP
34 If the switch
35 .B \-draftmessage
36 .I msg
37 is given, the specified draft is used to compose the message. If
38 .B \-draftmessage
39 .I msg
40 is not used, then the draft defaults to `new' (create a new draft)
41 unless the user invokes
42 .B comp
43 with
44 .BR \-use ,
45 in which case the default is `cur'.
46 .PP
47 Hence, the user may have several message compositions in progress
48 simultaneously. Now, all of the
49 .B nmh
50 tools are available on each of the user's message drafts (e.g.
51 .BR show ,
52 .BR scan ,
53 .BR pick ,
54 and so on). If the folder does not exist, the user is asked if it should be
55 created (just like with
56 .BR refile ).
57 The last draft message the user was composing is known as `cur'
58 in the draft folder.
59 .PP
60 Using
61 .BR send ,
62 the user can send drafts using the standard
63 .B nmh
64 `msgs' convention with
65 .B \-draftmessage
66 .IR msgs .
67 If no `msgs' are given, it defaults to `cur'.
68 .PP
69 In addition, all of these programs have a
70 .B \-nodraftfolder
71 switch, which undoes the last occurrence of
72 .B \-draftfolder
73 .I folder
74 (useful if a default is specified in the user's
75 .B nmh
76 profile).
77 .PP
78 If the user does not give the
79 .B \-draftfolder
80 .I +folder
81 switch, then all these commands act \*(lqnormally\*(rq. Note that the
82 .B \-draft
83 switch to
84 .B send
85 and
86 .B show
87 still refers to the file called `draft' in the user's
88 .B nmh
89 directory. In the interests of economy of expression, when using
90 .B comp
91 or
92 .BR send ,
93 the user needn't prefix the draft `msg' or `msgs' with
94 .BR \-draftmessage .
95 Both of these commands accept a `file' or `files' argument and they will,
96 if given
97 .B \-draftfolder
98 .IR +folder ,
99 treat these arguments as `msg' or `msgs'. (This may appear to be
100 inconsistent, at first, but it saves a lot of typing.) Hence,
101 .PP
102 .RS
103 .nf
104 send -draftfolder +drafts first
105 .fi
106 .RE
107 .PP
108 is the same as
109 .PP
110 .RS
111 .nf
112 send -draftfolder +drafts -draftmessage first
113 .fi
114 .RE
115 .PP
116 To make all this a bit more clear, here are some examples. Let's assume
117 that the following entries are in the
118 .B nmh
119 profile:
120 .PP
121 .RS 5
122 .nf
123 Draft\-Folder: drafts
124 sendf: \-draftfolder +drafts
125 .fi
126 .RE
127 .PP
128 Furthermore, let's assume that the program
129 .B sendf
130 is a (symbolic) link in the user's
131 .I $HOME/bin/
132 directory to
133 .BR send .
134 Now,
135 .PP
136 .RS 5
137 .nf
138 comp
139 dist
140 forw
141 repl
142 .fi
143 .RE
144 .PP
145 will construct the message draft in the `draft' folder using the `new'
146 message number. Furthermore, they each define `cur' in this folder to
147 be that message draft. If the user were to use the
148 .B quit
149 option at the `What now?' prompt, then later on, if no other draft composition
150 was done, the draft could be sent with simply
151 .PP
152 .RS 5
153 .nf
154 sendf
155 .fi
156 .RE
157 .PP
158 Or, if more editing was required, the draft could be edited with
159 .PP
160 .RS 5
161 .nf
162 comp -use
163 .fi
164 .RE
165 .PP
166 If other drafts had been composed in the meantime, so that this message
167 draft was no longer known as `cur' in the `draft' folder, then
168 the user could
169 .B scan
170 the folder to see which message draft should be used for editing or sending.
171 Clever users could even employ a backquoted
172 .B pick
173 to do the work:
174 .PP
175 .RS 5
176 .nf
177 comp -use `pick +drafts -to nmh-workers`
178 .fi
179 .RE
180 .PP
181 or
182 .PP
183 .RS 5
184 .nf
185 sendf `pick +drafts -to nmh-workers`
186 .fi
187 .RE
188 .PP
189 Note that in the
190 .B comp
191 example, the output from
192 .B pick
193 must resolve to a single message draft (it makes no sense to talk about
194 composing two or more drafts with one invocation of
195 .BR comp ).
196 In contrast, in the
197 .B send
198 example, as many message drafts as desired can appear, since
199 .B send
200 doesn't mind sending more than one draft at a time.
201 .PP
202 Note that the argument
203 .B \-draftfolder
204 .I +folder
205 is not included in the profile entry for
206 .BR send ,
207 since when
208 .BR comp ,
209 et al, invoke
210 .B send
211 directly, they supply
212 .B send
213 with the Unix pathname of the message draft;
214 .I not
215 a
216 .B \-draftmessage
217 .I msg
218 argument. As far as
219 .B send
220 is concerned, a draft folder is not being used.
221 .PP
222 It is important to realize that
223 .B nmh
224 treats the draft folder like a standard
225 .B nmh
226 folder in nearly all respects. There are two exceptions:
227 .PP
228 First, under no circumstances will the
229 .B \-draftfolder
230 .I folder
231 switch cause the named folder to become the current folder.
232 Obviously, if the folder appeared in the context of a standard
233 .I +folder
234 argument to an
235 .B nmh
236 program, as in
237 .PP
238 .RS 5
239 .nf
240 scan +drafts
241 .fi
242 .RE
243 .PP
244 it might become the current folder, depending on the context changes of the
245 .B nmh
246 program in question.
247 .PP
248 Second, although conceptually
249 .B send
250 deletes the `msgs' named in the draft folder, it does not call
251 .I delete\-prog
252 to perform the deletion.
253 .SS "What Happens if the Draft Exists"
254 When the
255 .BR comp ,
256 .BR dist ,
257 .BR forw ,
258 and
259 .B repl
260 commands
261 are invoked and the draft you indicated already exists, these programs
262 will prompt the user for a response directing the program's action.
263 The prompt is
264 .PP
265 .RS 5
266 .nf
267 Draft ``/home/foobar/nmhbox/draft'' exists (xx bytes).
268 Disposition?
269 .fi
270 .RE
271 .PP
272 The appropriate responses and their meanings are:
273 .PP
274 .RS 5
275 .PD 0
276 .TP 10
277 .B replace
278 deletes the draft and starts afresh
279 .TP
280 .B list
281 lists the draft
282 .TP
283 .B refile
284 files the draft into a folder and starts afresh
285 .TP 10
286 .B quit
287 leaves the draft intact and exits
288 .PD
289 .RE
290 .PP
291 In addition, if you specified
292 .B \-draftfolder
293 .I folder
294 to the command, then one other response will be accepted:
295 .PP
296 .RS 5
297 .PD 0
298 .TP 10
299 .B new
300 creates a new draft
301 .PD
302 .RE
303 .PP
304 just as if
305 .B \-draftmessage
306 .I new
307 had been given.
308 Finally, the
309 .B comp
310 command will accept one more response:
311 .PP
312 .RS 5
313 .PD 0
314 .TP 10
315 .B use
316 re-uses the draft
317 .PD
318 .RE
319 .PP
320 just as if
321 .B \-use
322 had been given.
323 .SH FILES
324 .PP
325 .TP 20
326 $HOME/.mh_profile
327 The user's profile.
328 .SH "PROFILE COMPONENTS"
329 .PP
330 .PD 0
331 .TP 20
332 Draft\-Folder:
333 For a default draft folder
334 .PD
335 .SH CONTEXT
336 None