From: markus schnalke Date: Wed, 4 Jan 2012 11:04:44 +0000 (+0100) Subject: Activated a default unseen sequence; updated man pages to it. X-Git-Tag: mmh-thesis-end~432 X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=c2360569e1d8d3678e294eb7c1354cb8bf7501c1;p=mmh Activated a default unseen sequence; updated man pages to it. --- diff --git a/man/mh-profile.man5 b/man/mh-profile.man5 index feffaca..ae8e7e9 100644 --- a/man/mh-profile.man5 +++ b/man/mh-profile.man5 @@ -94,22 +94,22 @@ man page for the details. (profile, no default) .RE .PP .BR Unseen\-Sequence : -unseen +u .RS 5 -Names the sequence or sequences which should be defined as those -messages which are unread. The commands +Names the sequence or sequences which shall contain any unread messages. +The commands .BR inc , .BR rcvstore , .BR mhshow , and .B show will add or remove messages from these -sequences when they are incorporated or read. If not present or -empty, no such sequences are defined. Otherwise, each message is +sequences when they are incorporated or read. If defined with an empty +value, no such sequences are defined. Otherwise, each message is added to, or removed from, each sequence name given. Read the .BR mh\-sequence (7) man page for the details about this sequence. -(profile, no default) +(profile, default: u) .RE .PP .BR Mh\-Sequences : diff --git a/man/mh-sequence.man7 b/man/mh-sequence.man7 index eb54adc..b96230e 100644 --- a/man/mh-sequence.man7 +++ b/man/mh-sequence.man7 @@ -215,37 +215,28 @@ will write to the file. .SS "The Unseen Sequence" -Finally, many users like to indicate which messages have not been -previously seen by them. The commands +Finally, the unseen sequence indicates which messages have not been +previously seen by the user. +The commands .BR inc , .BR rcvstore , .BR show , .BR mhshow , and .B flist -honor the profile entry -\*(lqUnseen\-Sequence\*(rq to support this activity. This entry -in the -.I .mmh/profile -should be defined as one or more sequence -names separated by spaces. If there is a value for -\*(lqUnseen\-Sequence\*(rq in the profile, then whenever new messages -are placed in a folder (using +honor the sequence. +Whenever new messages are placed in a folder (using .B inc or .BR rcvstore ), -the new messages will also be added to all the sequences named in this -profile entry. For example, a profile entry of -.PP -.RS 5 -Unseen\-Sequence: unseen +the new messages will also be added to the unseen sequence. .RE .PP -directs -.B inc -to add new messages to the sequence \*(lqunseen\*(rq. -Unlike the behavior of the \*(lqPrevious\-Sequence\*(rq entry in the -profile, however, the sequence(s) will +.BR inc , +for example, +adds new messages to the unseen sequence. +Unlike the behavior of the previous sequence, however, +the unseen sequence will .B not be zeroed by .BR inc . @@ -256,9 +247,19 @@ Similarly, whenever .BR next , or .B prev -displays a message, that message will be removed from -any sequences named by the \*(lqUnseen\-Sequence\*(rq entry in the -profile. +display a message, that message will be removed from +the unseen sequence. +.PP +The default unseen sequence is named `u'. +To change, define a \*(lqUnseen\-Sequence\*(rq entry in your profile. +It may also contain multiple sequence names, separated by spaces. +In this case, anything that applied to a single unseen sequence, +applies to multiple ones, too. +.PP +The unseen sequence mechanism is automatically activated. +To deactivate it, define the \*(lqUnseen\-Sequence\*(rq entry +in your profile with an empty value. + .SH FILES .fc ^ ~ diff --git a/sbr/seq_setunseen.c b/sbr/seq_setunseen.c index b18de5d..2bb09b9 100644 --- a/sbr/seq_setunseen.c +++ b/sbr/seq_setunseen.c @@ -20,7 +20,7 @@ void seq_setunseen(struct msgs *mp, int seen) { - int msgnum; + int n; char **ap, *cp, *dp; /* @@ -29,11 +29,13 @@ seq_setunseen(struct msgs *mp, int seen) */ if ((cp = context_find(usequence))) { dp = getcpy(cp); - if (!(ap = brkstring(dp, " ", "\n")) || !*ap) { - free(dp); - return; - } } else { + /* not set in profile, thus use the default */ + dp = getcpy(seq_unseen); + } + if (!(ap = brkstring(dp, " ", "\n")) || !*ap) { + /* contains no sequence name, i.e. we're finished */ + free(dp); return; } @@ -44,14 +46,19 @@ seq_setunseen(struct msgs *mp, int seen) for (; *ap; ap++) { if (seen) { /* make sure sequence exists first */ - if (seq_getnum(mp, *ap) != -1) - for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) - if (is_unseen(mp, msgnum)) - seq_delmsg(mp, *ap, msgnum); + if (seq_getnum(mp, *ap) != -1) { + for (n = mp->lowsel; n <= mp->hghsel; n++) { + if (is_unseen(mp, n)) { + seq_delmsg(mp, *ap, n); + } + } + } } else { - for (msgnum = mp->lowmsg; msgnum <= mp->hghmsg; msgnum++) - if (is_unseen(mp, msgnum)) - seq_addmsg(mp, *ap, msgnum, -1, 0); + for (n = mp->lowmsg; n <= mp->hghmsg; n++) { + if (is_unseen(mp, n)) { + seq_addmsg(mp, *ap, n, -1, 0); + } + } } } diff --git a/uip/flist.c b/uip/flist.c index d2a0490..31d01c1 100644 --- a/uip/flist.c +++ b/uip/flist.c @@ -242,26 +242,28 @@ main(int argc, char **argv) nmhdir = toabsdir("+"); /* - ** If we didn't specify any sequences, we search - ** for the "Unseen-Sequence" profile entry and use - ** all the sequences defined there. We check to - ** make sure that the Unseen-Sequence entry doesn't - ** contain more than NUMATTRS sequences. + ** If no sequences specified, we use the `unseen' sequence(s) + ** We check to make sure that the Unseen-Sequence entry doesn't + ** contain too many sequences. */ if (numsequences == 0) { - if ((cp = context_find(usequence)) && *cp) { - char **ap, *dp; + char **ap, *dp; - dp = getcpy(cp); - ap = brkstring(dp, " ", "\n"); - for (; ap && *ap; ap++) { - if (numsequences >= NUMATTRS) - adios(NULL, "too many sequences (more than %d) in %s profile entry", NUMATTRS, usequence); - else - sequencesToDo[numsequences++] = *ap; + if ((cp = context_find(usequence))) { + if (!*cp) { + adios(NULL, "profile entry %s set, but empty, and no sequence given", usequence); } } else { - adios(NULL, "no sequence specified or %s profile entry found", usequence); + cp = seq_unseen; /* use default */ + } + dp = getcpy(cp); + ap = brkstring(dp, " ", "\n"); + for (; ap && *ap; ap++) { + if (numsequences >= NUMATTRS) { + adios(NULL, "too many sequences (more than %d) in %s profile entry", NUMATTRS, usequence); + } else { + sequencesToDo[numsequences++] = *ap; + } } } diff --git a/uip/new.c b/uip/new.c index 7a5a06b..2ac56d6 100644 --- a/uip/new.c +++ b/uip/new.c @@ -501,12 +501,17 @@ main(int argc, char **argv) } if (i == 0) { + char *dp; /* no sequence arguments; use unseen */ - unseen = context_find(usequence); - if (unseen == NULL || unseen[0] == '\0') { - adios(NULL, "must specify sequences or set %s", usequence); + if ((unseen = context_find(usequence))) { + if (!*unseen) { + adios(NULL, "profile entry %s set, but empty, and no sequences given", usequence); + } + } else { + unseen = seq_unseen; /* use default */ } - for (ap = brkstring(unseen, " ", "\n"); *ap; ap++) { + dp = getcpy(unseen); + for (ap = brkstring(dp, " ", "\n"); *ap; ap++) { sequences[i++] = *ap; } } diff --git a/uip/scan.c b/uip/scan.c index 69c2da9..ea05cd2 100644 --- a/uip/scan.c +++ b/uip/scan.c @@ -231,20 +231,23 @@ main(int argc, char **argv) context_save(); /* save the context file */ /* - ** Get the sequence number for each sequence - ** specified by Unseen-Sequence + ** Get the sequence number for each `unseen' sequence */ - if ((cp = context_find(usequence)) && *cp) { + if (!(cp = context_find(usequence))) { + cp = seq_unseen; /* use default, if not set */ + } + if (*cp) { char **ap, *dp; dp = getcpy(cp); ap = brkstring(dp, " ", "\n"); - for (i = 0; ap && *ap; i++, ap++) + for (i = 0; ap && *ap; i++, ap++) { seqnum[i] = seq_getnum(mp, *ap); - + } num_unseen_seq = i; - if (dp) + if (dp) { free(dp); + } } ontty = isatty(fileno(stdout));