The Previus-Sequence was racy and introduce a lot of write accesses.
Also most use cases can solved better with shell history and command
line editing.
char *seq_neg = "!";
char *usequence = "Unseen-Sequence";
-char *psequence = "Previous-Sequence";
char *nsequence = "Sequence-Negation";
/* profile entries for storage locations */
extern char *nmhstorage;
extern char *nsequence;
extern char *profile;
-extern char *psequence;
extern char *rcvdistcomps;
extern char *replcomps;
extern char *replgroupcomps;
(profile, default: inbox)
.RE
.PP
-.BR Previous\-Sequence :
-.I pseq
-.RS 5
-Names the sequence or sequences which should be defined as the `msgs' or
-`msg' argument given to any
-.B mmh
-command. If not present or empty,
-no such sequences are defined. Otherwise, for each name given, the
-sequence is first zero'd and then each message is added to the sequence.
-Read the
-.BR mh\-sequence (7)
-man page for the details about this sequence. (profile, no default)
-.RE
-.PP
.BR Sequence\-Negation :
\&!
.RS 5
To deactivate the negation mechanism, define Sequence\-Negation in your
profile to an empty value.
-.SS "The Previous Sequence"
-.B Mmh
-provides the ability to remember the `msgs' or `msg' argument
-last given to an
-.B mmh
-command. The entry `Previous\-Sequence'
-should be defined in the
-.B mmh
-profile; its value should be a sequence
-name or multiple sequence names separated by spaces. If this entry
-is defined, when an
-.B mmh
-command finishes, it will define the
-sequence(s) named in the value of this entry to be those messages that
-were specified to the command. Hence, a profile entry of
-.PP
-.RS 5
-Previous\-Sequence: pseq
-.RE
-.PP
-directs any
-.B mmh
-command that accepts a `msg' or `msgs' argument to
-define the sequence `pseq' as those messages when it finishes.
-.PP
-.BR Note :
-there can be a performance penalty in using the
-`Previous\-Sequence' facility. If it is used,
-.B all
-.B mmh
-programs have to write the sequence information to the
-.I \&.mh_sequences
-file for the folder each time they run. If the
-`Previous\-Sequence' profile entry is not included, only
-.B pick
-and
-.B mark
-will write to the
-.B \&.mh_sequences
-file.
-
.SS "The Unseen Sequence"
Finally, the unseen sequence indicates which messages have not been
previously seen by the user.
.BR inc ,
for example,
adds new messages to the unseen sequence.
-Unlike the behavior of the previous sequence, however,
-the unseen sequence will
+The unseen sequence will
.B not
be zeroed by
.BR inc .
.PP
-Similarly, whenever
+Whenever
.BR show ,
.BR next ,
or
.ta \w'ExtraBigProfileName 'u
^Mh-Sequences:~^Name of file to store public sequences
^Sequence\-Negation:~^To designate messages not in a sequence
-^Previous\-Sequence:~^The last message specification given
^Unseen\-Sequence:~^Those messages not yet seen by the user
.fi
.SH "SEE ALSO"
flist(1), mark(1), pick(1), mh-profile(5)
+.SH "HISTORY"
+.SS Previous\-Sequence
+This sequence stored the selected messages for the previous
+.B mmh
+command.
+It was disabled by default because it introduced a lot of extra writes to the
+.IR \&.mh_sequences
+file.
+Additionally, it introduced possible race conditions when running multiple
+.B mmh
+commands in parallel.
+As this feature was rarely used, it was removed.
+
.SH DEFAULTS
None
is specified, the current message in the
source folder will be set to the last message specified; otherwise, the
current message won't be changed.
-.PP
-If the `Previous\-Sequence' profile entry is set, in addition to defining
-the named sequences from the source folder,
-.B refile
-will also define
-those sequences for the destination folders. See
-.B mh\-sequence (7)
-for information concerning the previous sequence.
.SH HISTORY
Since mmh-0.3,
readconfig.c seq_add.c seq_bits.c \
seq_del.c seq_getnum.c seq_list.c seq_nameok.c \
seq_print.c seq_read.c seq_save.c seq_setcur.c \
- seq_setprev.c seq_setunseen.c signals.c \
+ seq_setunseen.c signals.c \
smatch.c snprintb.c strcasecmp.c \
strindex.c trim.c trimcpy.c uprf.c vfgets.c fmt_def.c \
mf.c utils.c m_mktemp.c seq_msgstats.c \
*/
if (!m_convert(mp, which))
exit(EX_SOFTWARE);
- seq_setprev(mp);
snprintf(buffer, sizeof(buffer), "%s/%s", mp->foldpath,
m_name(mp->lowsel));
+++ /dev/null
-/*
-** seq_setprev.c -- set the Previous-Sequence
-**
-** This code is Copyright (c) 2002, by the authors of nmh. See the
-** COPYRIGHT file in the root directory of the nmh distribution for
-** complete copyright information.
-*/
-
-#include <h/mh.h>
-#include <h/utils.h>
-
-/*
-** Add all the messages currently SELECTED to
-** the Previous-Sequence. This way, when the next
-** command is given, there is a convenient way to
-** selected all the messages used in the previous
-** command.
-*/
-
-void
-seq_setprev(struct msgs *mp)
-{
- char **ap, *cp, *dp;
-
- /*
- ** Get the list of sequences for Previous-Sequence
- ** and split them.
- */
- if ((cp = context_find(psequence))) {
- dp = mh_xstrdup(cp);
- if (!(ap = brkstring(dp, " ", "\n")) || !*ap) {
- mh_free0(&dp);
- return;
- }
- } else {
- return;
- }
-
- /* Now add all SELECTED messages to each sequence */
- for (; *ap; ap++)
- seq_addsel(mp, *ap, -1, 1);
-
- mh_free0(&dp);
-}
for (msgnum = 0; msgnum < msgp; msgnum++)
if (!m_convert(mp, msgs[msgnum]))
exit(EX_SOFTWARE);
- seq_setprev(mp); /* set the previous-sequence */
smsgs = mh_xcalloc(MAXFOLDER + 2, sizeof(*smsgs));
if (!m_convert(mp, msg)) {
exit(EX_SOFTWARE);
}
- seq_setprev(mp); /* set the previous-sequence */
if (mp->numsel > 1) {
adios(EX_USAGE, NULL, "only one message at a time!");
}
if (!m_convert(mp, msg)) {
exit(EX_USAGE);
}
- seq_setprev(mp);
if (mp->numsel > 1) {
adios(EX_USAGE, NULL, "only one message at a time!");
admonish(NULL, "only one message at a time!");
return 0;
}
- seq_setprev(mp); /* set the previous-sequence */
seq_setcur(mp, mp->lowsel); /* set current message */
seq_save(mp); /* synchronize message sequences */
context_save(); /* save the context file */
exit(EX_SOFTWARE);
}
}
- seq_setprev(mp); /* set the previous sequence */
if ((out = creat(drft, m_gmprot())) == NOTOK)
adios(EX_CANTCREAT, drft, "unable to create");
exit(EX_SOFTWARE);
}
}
- seq_setprev(mp); /* set the previous-sequence */
cts = mh_xcalloc(mp->numsel + 1, sizeof(*cts));
ctp = cts;
{ "mimetypequery-component", &mimetypequery },
{ "nmhstorage-component", &nmhstorage },
{ "nsequence-component", &nsequence },
- { "psequence-component", &psequence },
{ "usequence-component", &usequence },
{ "#--Mmh-specific-Mail-Header-Names--", &empty },
{ "seq-first", &seq_first },
{ "seq-last", &seq_last },
{ "seq-next", &seq_next },
- { "previous-sequence", &seq_prev },
{ "unseen-sequence", &seq_unseen },
{ "sequence-negation", &seq_neg },
}
}
- seq_setprev(mp); /* set the previous-sequence */
-
/* print the path of all selected messages */
for (i = mp->lowsel; i <= mp->hghsel; i++)
if (is_selected(mp, i))
if (is_selected(mp, msgnum))
set_unseen(mp, msgnum);
- seq_setprev(mp); /* set the Previous-Sequence */
seq_setunseen(mp, 0); /* unset unseen seqs for shown msgs */
cts = mh_xcalloc(mp->numsel + 1, sizeof(*cts));
for (msgnum = 0; msgnum < msgs.size; msgnum++)
if (!m_convert(mp, msgs.msgs[msgnum]))
exit(EX_USAGE);
- seq_setprev(mp); /* set the previous-sequence */
cts = mh_xcalloc(mp->numsel + 1, sizeof(*cts));
ctp = cts;
for (msgnum = 0; msgnum < msgs.size; msgnum++)
if (!m_convert(mp, msgs.msgs[msgnum]))
exit(EX_USAGE);
- seq_setprev(mp); /* set the previous-sequence */
cts = mh_xcalloc(mp->numsel + 1, sizeof(*cts));
ctp = cts;
for (msgnum = 0; msgnum < msgs.size; msgnum++)
if (!m_convert(mp, msgs.msgs[msgnum]))
exit(EX_USAGE);
- seq_setprev(mp); /* set the previous-sequence */
/* copy all the SELECTED messages to stdout */
for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
for (msgnum = 0; msgnum < msgs.size; msgnum++)
if (!m_convert(mp, msgs.msgs[msgnum]))
exit(EX_USAGE);
- seq_setprev(mp); /* set the previous-sequence */
/*
** If we aren't saving the results to a sequence,
exit(EX_SOFTWARE);
}
}
- seq_setprev(mp);
/* create folder structures for each destination folder */
opnfolds(folders, foldp);
for (fp = folders, ep = folders + nfolders; fp < ep; fp++) {
mp = fp->f_mp;
- seq_setprev(mp);
seq_save(mp);
}
}
/* parse the message range/sequence/name and set SELECTED */
if (!m_convert(mp, msg))
exit(EX_SOFTWARE);
- seq_setprev(mp); /* set the previous-sequence */
if (mp->numsel > 1)
adios(EX_USAGE, NULL, "only one message at a time!");
if (unlink_msgs) {
/* "remove" the SELECTED messages */
folder_delmsgs(mp, 1);
- seq_setprev(mp);
seq_save(mp);
folder_free(mp);
return 0;
exit(EX_USAGE);
}
}
- seq_setprev(mp);
for (nmsgs = 0, msgnum = mp->lowsel;
msgnum <= mp->hghsel; msgnum++) {
for (msgnum = 0; msgnum < msgs.size; msgnum++)
if (!m_convert(mp, msgs.msgs[msgnum]))
exit(EX_USAGE);
- seq_setprev(mp); /* set the previous sequence */
if ((nmsgs = read_hdrs(mp, datesw)) <= 0)
adios(EX_DATAERR, NULL, "no messages to sort");