]> diplodocus.org Git - nmh/blob - man/mh-sequence.man
getpass.c: Move interface to own file.
[nmh] / man / mh-sequence.man
1 .TH MH-SEQUENCE %manext5% 2013-10-17 "%nmhversion%"
2 .
3 .\" %nmhwarning%
4 .
5 .SH NAME
6 mh-sequence \- sequence specification for nmh message system
7 .SH DESCRIPTION
8 A sequence (or sequence set) is a symbolic name representing a
9 message or collection of messages.
10 .B nmh
11 has several internally defined sequences, as well as allowing
12 users to define their own sequences.
13 .SS "Message Specification and Pre-Defined Message Sequences"
14 Most
15 .B nmh
16 commands accept a `msg' or `msgs' specification, where `msg'
17 indicates one message and `msgs' indicates one or more messages.
18 To designate a message, you may use either its number (e.g., 1, 10, 234)
19 or one of these \*(lqreserved\*(rq message names:
20 .PP
21 .RS 5
22 .PD 0
23 .TP
24 .B first
25 the first message in the folder
26 .TP
27 .B last
28 the last message in the folder
29 .TP
30 .B cur
31 the most recently accessed message
32 .TP
33 .B prev
34 the message numerically preceding \*(lqcur\*(rq
35 .TP
36 .B next
37 the message numerically following \*(lqcur\*(rq
38 .RE
39 .PD
40 .PP
41 In commands that take a `msg' argument, the default is \*(lqcur\*(rq.
42 As a shorthand, \*(lq.\*(rq is equivalent to \*(lqcur\*(rq.
43 .PP
44 For example: In a folder containing five messages numbered 5, 10, 94, 177
45 and 325, \*(lqfirst\*(rq is 5 and \*(lqlast\*(rq is 325. If \*(lqcur\*(rq
46 is 94, then \*(lqprev\*(rq is 10 and \*(lqnext\*(rq is 177.
47 .PP
48 The word `msgs' indicates that one or more messages may be specified.
49 Such a specification consists of one message designation or of several
50 message designations, as separate arguments. A message designation consists
51 either of a message name as defined above, or a message range.
52 .PP
53 A message range is specified as \*(lqname1\-name2\*(rq or
54 \*(lqname:n\*(rq, where `name', `name1' and `name2' are message names,
55 and `n' is an integer.
56 .PP
57 The specification \*(lqname1\-name2\*(rq designates all currently existing
58 messages from `name1' to `name2' inclusive. The \*(lqreserved\*(rq
59 message name \*(lqall\*(rq is a shorthand for the message range
60 \*(lqfirst\-last\*(rq.
61 .PP
62 The specification \*(lqname:n\*(rq designates up to `n' messages.
63 These messages start with `name' if `name' is a message number or one of
64 the reserved names \*(lqfirst\*(rq \*(lqcur\*(rq, or \*(lqnext\*(rq, The
65 messages end with `name' if `name' is \*(lqprev\*(rq or \*(lqlast\*(rq.
66 The interpretation of `n' may be overridden by preceding `n' with a
67 plus or minus sign; `+n' always means up to `n' messages starting with
68 `name', and `\-n' always means up to `n' messages ending with `name'.
69 .PP
70 Substituting `=' for `:' (i.e., \*(lqname=n\*(rq) will reduce the
71 selection from a range of up to `n' messages, to a selection of
72 just the `n'th message. So for example, while \*(lqname:-3\*(rq
73 selects the 3 messages ending with `name', \*(lqname=-3\*(rq selects
74 just the 2nd previous message. It is an error if the requested
75 message does not exist (i.e., there aren't enough messages in the
76 folder).
77 .PP
78 In commands which accept a `msgs' argument, the default is either
79 \*(lqcur\*(rq or \*(lqall\*(rq, depending on which makes more sense
80 for each command (see the individual man pages for details). Repeated
81 specifications of the same message have the same effect as a single
82 specification of the message.
83 .PP
84 There is also a special \*(lqreserved\*(rq message name \*(lqnew\*(rq
85 which is used by the
86 .B mhpath
87 command.
88 .SS "User\-Defined Message Sequences"
89 In addition to the \*(lqreserved\*(rq (pre-defined) message names given
90 above,
91 .B nmh
92 supports user-defined sequence names. User-defined sequences allow the
93 .B nmh
94 user a tremendous amount of power in dealing with groups of messages
95 in the same folder by allowing the user to bind a group of messages
96 to a meaningful symbolic name.
97 .PP
98 The name used to denote a message sequence must consist of an alphabetic
99 character followed by zero or more alphanumeric characters, and can not
100 be one of the \*(lqreserved\*(rq message names above. After defining a
101 sequence, it can be used wherever an
102 .B nmh
103 command expects a `msg' or
104 `msgs' argument.
105 .PP
106 Some forms of message ranges are allowed with user-defined sequences.
107 The specification \*(lqname:n\*(rq may be used, and it designates up
108 to the first `n' messages (or last `n' messages for `\-n') which are
109 elements of the user-defined sequence `name'.
110 .PP
111 The specifications \*(lqname:next\*(rq and \*(lqname:prev\*(rq may also
112 be used, and they designate the next or previous message (relative to the
113 current message) which is an element of the user-defined sequence `name'.
114 The specifications \*(lqname:first\*(rq and \*(lqname:last\*(rq are
115 equivalent to \*(lqname:1\*(rq and \*(lqname:\-1\*(rq, respectively. The
116 specification \*(lqname:cur\*(rq is not allowed (use just \*(lqcur\*(rq
117 instead). The syntax of these message range specifications is subject
118 to change in the future.
119 .PP
120 Single messages (as opposed to ranges) may also be selected by
121 substituting `=' for `:', as in \*(lqname=n\*(rq. This will reduce
122 the selection from being a range of up to `n' messages, to being a
123 selection of just the `n'th message. So while \*(lqseq:5\*(rq
124 selects the first 5 messages of sequence `seq', \*(lqseq=5\*(rq
125 selects just the 5th message of the sequence. It is
126 an error if the requested message does not exist (i.e., there aren't
127 at least `n' messages in the sequence).
128 .PP
129 User-defined sequence names are specific to each folder. They are
130 defined using the
131 .B pick
132 and
133 .B mark
134 commands.
135 .SS "Public and Private User-Defined Sequences"
136 There are two varieties of user-defined sequences:
137 public and private. Public sequences of a folder are accessible to any
138 .B nmh
139 user that can read that folder. They are kept in each folder
140 in the file determined by the \*(lqmh\-sequences\*(rq profile entry
141 (default is
142 .IR \&.mh_sequences ).
143 Private sequences are accessible
144 only to the
145 .B nmh
146 user that defined those sequences and are kept in
147 the user's
148 .B nmh
149 context file.
150 .PP
151 In general, the commands that create sequences (such as
152 .B pick
153 and
154 .BR mark )
155 will create public sequences if the folder for which
156 the sequences are being defined is writable by the
157 .B nmh
158 user.
159 For most commands, this can be overridden by using the switches
160 .B \-public
161 and
162 .BR \-private .
163 But if the folder is read-only, or if
164 the \*(lqmh\-sequences\*(rq profile entry is defined but empty, then
165 \fIprivate\fR sequences will be created instead.
166 .SS "Sequence Negation"
167 .B Nmh
168 provides the ability to select all messages not elements of a
169 user-defined sequence. To do this, the user should define the entry
170 \*(lqSequence\-Negation\*(rq in the
171 .B nmh
172 profile file; its value
173 may be any string. This string is then used to preface an existing
174 user-defined sequence name. This specification then refers to those
175 messages not elements of the specified sequence name. For example, if
176 the profile entry is:
177 .PP
178 .RS 5
179 Sequence\-Negation: not
180 .RE
181 .PP
182 then any time an
183 .B nmh
184 command is given \*(lqnotfoo\*(rq as a `msg' or
185 `msgs' argument, it would substitute all messages that are not elements
186 of the sequence \*(lqfoo\*(rq.
187 .PP
188 Obviously, the user should beware of defining sequences with names that
189 begin with the value of the \*(lqSequence\-Negation\*(rq profile entry.
190 .SS "The Previous Sequence"
191 .B Nmh
192 provides the ability to remember the `msgs' or `msg' argument
193 last given to an
194 .B nmh
195 command. The entry \*(lqPrevious\-Sequence\*(rq
196 should be defined in the
197 .B nmh
198 profile; its value should be a sequence
199 name or multiple sequence names, as separate arguments. If this entry
200 is defined, when an
201 .B nmh
202 command finishes, it will define the sequence(s) named in the value
203 of this entry to be those messages that were specified to the command.
204 Hence, a profile entry of
205 .PP
206 .RS 5
207 Previous\-Sequence: pseq
208 .RE
209 .PP
210 directs any
211 .B nmh
212 command that accepts a `msg' or `msgs' argument to define the sequence
213 \*(lqpseq\*(rq as those messages when it finishes.
214 .PP
215 .BR Note :
216 there can be a performance penalty in using the
217 \*(lqPrevious\-Sequence\*(rq facility. If it is used,
218 .B all
219 .B nmh
220 programs have to write the sequence information to the
221 .I \&.mh_sequences
222 file for the folder each time they run. If the
223 \*(lqPrevious\-Sequence\*(rq profile entry is not included, only
224 .B pick
225 and
226 .B mark
227 will write to the
228 .B \&.mh_sequences
229 file.
230 .SS "The Unseen Sequence"
231 Finally, many users like to indicate which messages have not been
232 previously seen by them. The commands
233 .BR flist ,
234 .BR inc ,
235 .BR mhshow ,
236 .BR rcvstore ,
237 and
238 .B show
239 honor the profile entry \*(lqUnseen\-Sequence\*(rq to support this
240 activity. This entry in the
241 .I \&.mh_profile
242 should be defined as one or more sequence names, as separate arguments.
243 If there is a value for \*(lqUnseen\-Sequence\*(rq in the profile,
244 then whenever new messages are placed in a folder (using
245 .B inc
246 or
247 .BR rcvstore ),
248 the new messages will also be added to all the sequences named in this
249 profile entry. For example, a profile entry of
250 .PP
251 .RS 5
252 Unseen\-Sequence: unseen
253 .RE
254 .PP
255 directs
256 .B inc
257 to add new messages to the sequence \*(lqunseen\*(rq.
258 Unlike the behavior of the \*(lqPrevious\-Sequence\*(rq entry in the
259 profile, however, the sequence(s) will
260 .I not
261 be zeroed by
262 .BR inc .
263 .PP
264 Similarly, whenever
265 .BR show ,
266 .BR mhshow ,
267 .BR next ,
268 or
269 .B prev
270 displays a message, that message will be removed from any sequences
271 named by the \*(lqUnseen\-Sequence\*(rq entry in the profile.
272 .SS Sequence File Format
273 The sequence file format is based on the RFC 5322 message format. Each line
274 of the sequence file corresponds to one sequence. The line starts with the
275 sequence name followed by a `:', then followed by a space-separated list of
276 message numbers that correspond to messages that are part of the named sequence.
277 A contiguous range of messages can be represented as \*(lqlownum\-highnum\*(rq.
278 .PP
279 .B Sample sequence file
280 .PP
281 .RS 5
282 .nf
283 work: 3 6 8 22-33 46
284 unseen: 47 49-51 54
285 cur: 46
286 .fi
287 .RE
288 .PP
289 .B Nmh
290 commands that modify the sequence file will silently remove sequences for
291 nonexistent messages when the sequence file is updated. The exception to
292 this is the \*(lqcur\*(rq sequence, which is allowed to point to a
293 nonexistent message.
294 .SS Sequence File Locking
295 The \*(lqdatalocking\*(rq profile entry controls the type of locking used
296 when reading and writing sequence files. The locking mechanisms supported
297 are detailed in
298 .IR mh\-profile (5).
299 This protects sequence file integrity when multiple
300 .B nmh
301 commands are run simultaneously.
302 .B Nmh
303 commands that modify the sequence file use transactional locks; the lock
304 is held from the time the sequence file is read until it it written out.
305 This ensures that modifications to the sequence file will not be lost
306 if multiple commands are run simultaneously. Long-running
307 .B nmh
308 commands, such as
309 .B inc
310 and
311 .BR pick ,
312 will release the sequence lock during the bulk of their runtime and reread
313 the sequence file after their processing is complete to reduce lock
314 contention time.
315 .PP
316 Note:
317 Currently transactional locks are only supported for public sequences;
318 private sequences will not get corrupted, but the possibility exists that two
319 .B nmh
320 commands run simultaneously that add messages to a private sequence could result in
321 one command's messages not appearing on the requested sequence.
322 .SH FILES
323 .PD 0
324 .TP 20
325 $HOME/.mh\-profile
326 The user's profile.
327 .TP 20
328 <mh-dir>/context
329 The user's context.
330 .TP 20
331 <folder>/.mh\-sequences
332 File for public sequences.
333 .PD
334 .SH "PROFILE COMPONENTS"
335 .PD 0
336 .TP 20
337 mh-sequences:
338 Name of file to store public sequences.
339 .TP 20
340 Sequence\-Negation:
341 To designate messages not in a sequence.
342 .TP 20
343 Previous\-Sequence:
344 The last message specification given.
345 .TP 20
346 Unseen\-Sequence:
347 Those messages not yet seen by the user.
348 .PD
349 .SH "SEE ALSO"
350 .IR flist (1),
351 .IR mark (1),
352 .IR pick (1),
353 .IR mh-profile (5)
354 .SH DEFAULTS
355 None