remove Previus-Sequence support
authorPhilipp Takacs <philipp@bureaucracy.de>
Sun, 8 Dec 2019 16:54:29 +0000 (17:54 +0100)
committerPhilipp Takacs <philipp@bureaucracy.de>
Thu, 26 Mar 2020 20:36:00 +0000 (21:36 +0100)
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.

26 files changed:
config/config.c
h/mh.h
man/mh-profile.man5
man/mh-sequence.man7
man/refile.man1
sbr/Makefile.in
sbr/m_draft.c
sbr/seq_setprev.c [deleted file]
uip/burst.c
uip/comp.c
uip/dist.c
uip/folder.c
uip/forw.c
uip/mhlist.c
uip/mhparam.c
uip/mhpath.c
uip/mhshow.c
uip/mhstore.c
uip/mhtest.c
uip/packf.c
uip/pick.c
uip/refile.c
uip/repl.c
uip/rmm.c
uip/send.c
uip/sortm.c

index 5e25041..0a63912 100644 (file)
@@ -89,7 +89,6 @@ char *seq_unseen = "u";
 char *seq_neg    = "!";
 
 char *usequence = "Unseen-Sequence";
 char *seq_neg    = "!";
 
 char *usequence = "Unseen-Sequence";
-char *psequence = "Previous-Sequence";
 char *nsequence = "Sequence-Negation";
 
 /* profile entries for storage locations */
 char *nsequence = "Sequence-Negation";
 
 /* profile entries for storage locations */
diff --git a/h/mh.h b/h/mh.h
index 6337a0c..649582d 100644 (file)
--- a/h/mh.h
+++ b/h/mh.h
@@ -288,7 +288,6 @@ extern char *msgprot;
 extern char *nmhstorage;
 extern char *nsequence;
 extern char *profile;
 extern char *nmhstorage;
 extern char *nsequence;
 extern char *profile;
-extern char *psequence;
 extern char *rcvdistcomps;
 extern char *replcomps;
 extern char *replgroupcomps;
 extern char *rcvdistcomps;
 extern char *replcomps;
 extern char *replgroupcomps;
index 3b692ee..3c59e62 100644 (file)
@@ -65,20 +65,6 @@ Defines the name of your default inbox.
 (profile, default: inbox)
 .RE
 .PP
 (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
 .BR Sequence\-Negation :
 \&!
 .RS 5
index 0ad2c4a..c793d7e 100644 (file)
@@ -197,47 +197,6 @@ you might need to quote the exlamation mark (prefix it with a backslash).
 To deactivate the negation mechanism, define Sequence\-Negation in your
 profile to an empty value.
 
 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.
 .SS "The Unseen Sequence"
 Finally, the unseen sequence indicates which messages have not been
 previously seen by the user.
@@ -258,13 +217,12 @@ the new messages will also be added to the unseen sequence.
 .BR inc ,
 for example,
 adds new messages to the unseen sequence.
 .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
 .B not
 be zeroed by
 .BR inc .
 .PP
-Similarly, whenever
+Whenever
 .BR show ,
 .BR next ,
 or
 .BR show ,
 .BR next ,
 or
@@ -299,12 +257,24 @@ in your profile with an empty value.
 .ta \w'ExtraBigProfileName  'u
 ^Mh-Sequences:~^Name of file to store public sequences
 ^Sequence\-Negation:~^To designate messages not in a sequence
 .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)
 
 ^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
 .SH DEFAULTS
 None
index 2909230..37a6f0f 100644 (file)
@@ -130,14 +130,6 @@ If
 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.
 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,
 
 .SH HISTORY
 Since mmh-0.3,
index f2310fb..142a7f2 100644 (file)
@@ -68,7 +68,7 @@ SRCS = addrsbr.c ambigsw.c brkstring.c  \
        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  \
        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 \
        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 \
index ee85790..050c7e5 100644 (file)
@@ -53,7 +53,6 @@ m_draft(char *which)
        */
        if (!m_convert(mp, which))
                exit(EX_SOFTWARE);
        */
        if (!m_convert(mp, which))
                exit(EX_SOFTWARE);
-       seq_setprev(mp);
 
        snprintf(buffer, sizeof(buffer), "%s/%s", mp->foldpath,
                        m_name(mp->lowsel));
 
        snprintf(buffer, sizeof(buffer), "%s/%s", mp->foldpath,
                        m_name(mp->lowsel));
diff --git a/sbr/seq_setprev.c b/sbr/seq_setprev.c
deleted file mode 100644 (file)
index f4304cc..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-** 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);
-}
index 12d1f9d..09a60d9 100644 (file)
@@ -117,7 +117,6 @@ main(int argc, char **argv)
        for (msgnum = 0; msgnum < msgp; msgnum++)
                if (!m_convert(mp, msgs[msgnum]))
                        exit(EX_SOFTWARE);
        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));
 
 
        smsgs = mh_xcalloc(MAXFOLDER + 2, sizeof(*smsgs));
 
index 75bbf86..907bbf3 100644 (file)
@@ -148,7 +148,6 @@ main(int argc, char **argv)
                if (!m_convert(mp, msg)) {
                        exit(EX_SOFTWARE);
                }
                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 (mp->numsel > 1) {
                        adios(EX_USAGE, NULL, "only one message at a time!");
                }
index 1d5c3aa..66539e6 100644 (file)
@@ -153,7 +153,6 @@ main(int argc, char **argv)
        if (!m_convert(mp, msg)) {
                exit(EX_USAGE);
        }
        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!");
 
        if (mp->numsel > 1) {
                adios(EX_USAGE, NULL, "only one message at a time!");
index b7cdfe5..945e4fc 100644 (file)
@@ -615,7 +615,6 @@ sfold(struct msgs *mp, char *msg)
                admonish(NULL, "only one message at a time!");
                return 0;
        }
                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 */
        seq_setcur(mp, mp->lowsel);  /* set current message */
        seq_save(mp);  /* synchronize message sequences */
        context_save();  /* save the context file */
index e00ae0e..d6ded24 100644 (file)
@@ -197,7 +197,6 @@ main(int argc, char **argv)
                        exit(EX_SOFTWARE);
                }
        }
                        exit(EX_SOFTWARE);
                }
        }
-       seq_setprev(mp);  /* set the previous sequence */
 
        if ((out = creat(drft, m_gmprot())) == NOTOK)
                adios(EX_CANTCREAT, drft, "unable to create");
 
        if ((out = creat(drft, m_gmprot())) == NOTOK)
                adios(EX_CANTCREAT, drft, "unable to create");
index 7056db5..169ca50 100644 (file)
@@ -230,7 +230,6 @@ main(int argc, char **argv)
                                exit(EX_SOFTWARE);
                        }
                }
                                exit(EX_SOFTWARE);
                        }
                }
-               seq_setprev(mp);  /* set the previous-sequence */
 
                cts = mh_xcalloc(mp->numsel + 1, sizeof(*cts));
                ctp = cts;
 
                cts = mh_xcalloc(mp->numsel + 1, sizeof(*cts));
                ctp = cts;
index 2c61e60..e02bf49 100644 (file)
@@ -78,7 +78,6 @@ static struct proc procs [] = {
        { "mimetypequery-component",     &mimetypequery },
        { "nmhstorage-component",        &nmhstorage },
        { "nsequence-component",         &nsequence },
        { "mimetypequery-component",     &mimetypequery },
        { "nmhstorage-component",        &nmhstorage },
        { "nsequence-component",         &nsequence },
-       { "psequence-component",         &psequence },
        { "usequence-component",         &usequence },
 
        { "#--Mmh-specific-Mail-Header-Names--", &empty },
        { "usequence-component",         &usequence },
 
        { "#--Mmh-specific-Mail-Header-Names--", &empty },
@@ -109,7 +108,6 @@ static struct proc procs [] = {
        { "seq-first",         &seq_first },
        { "seq-last",          &seq_last },
        { "seq-next",          &seq_next },
        { "seq-first",         &seq_first },
        { "seq-last",          &seq_last },
        { "seq-next",          &seq_next },
-       { "previous-sequence", &seq_prev },
        { "unseen-sequence",   &seq_unseen },
        { "sequence-negation", &seq_neg },
 
        { "unseen-sequence",   &seq_unseen },
        { "sequence-negation", &seq_neg },
 
index 31e0722..df4e140 100644 (file)
@@ -123,8 +123,6 @@ main(int argc, char **argv)
                }
        }
 
                }
        }
 
-       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))
        /* print the path of all selected messages */
        for (i = mp->lowsel; i <= mp->hghsel; i++)
                if (is_selected(mp, i))
index be9cd45..6978454 100644 (file)
@@ -301,7 +301,6 @@ main(int argc, char **argv)
                        if (is_selected(mp, msgnum))
                                set_unseen(mp, msgnum);
 
                        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));
                seq_setunseen(mp, 0);  /* unset unseen seqs for shown msgs */
 
                cts = mh_xcalloc(mp->numsel + 1, sizeof(*cts));
index 47b7c02..971ee7e 100644 (file)
@@ -292,7 +292,6 @@ main(int argc, char **argv)
                for (msgnum = 0; msgnum < msgs.size; msgnum++)
                        if (!m_convert(mp, msgs.msgs[msgnum]))
                                exit(EX_USAGE);
                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;
 
                cts = mh_xcalloc(mp->numsel + 1, sizeof(*cts));
                ctp = cts;
index d4bf6a6..71787af 100644 (file)
@@ -240,7 +240,6 @@ main(int argc, char **argv)
                for (msgnum = 0; msgnum < msgs.size; msgnum++)
                        if (!m_convert(mp, msgs.msgs[msgnum]))
                                exit(EX_USAGE);
                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;
 
                cts = mh_xcalloc(mp->numsel + 1, sizeof(*cts));
                ctp = cts;
index fe1102c..b2726f4 100644 (file)
@@ -95,7 +95,6 @@ main(int argc, char **argv)
        for (msgnum = 0; msgnum < msgs.size; msgnum++)
                if (!m_convert(mp, msgs.msgs[msgnum]))
                        exit(EX_USAGE);
        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++) {
 
        /* copy all the SELECTED messages to stdout */
        for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
index 8f28f35..0b9205b 100644 (file)
@@ -340,7 +340,6 @@ main(int argc, char **argv)
        for (msgnum = 0; msgnum < msgs.size; msgnum++)
                if (!m_convert(mp, msgs.msgs[msgnum]))
                        exit(EX_USAGE);
        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,
 
        /*
        ** If we aren't saving the results to a sequence,
index 682f66a..663936b 100644 (file)
@@ -188,7 +188,6 @@ main(int argc, char **argv)
                        exit(EX_SOFTWARE);
                }
        }
                        exit(EX_SOFTWARE);
                }
        }
-       seq_setprev(mp);
 
        /* create folder structures for each destination folder */
        opnfolds(folders, foldp);
 
        /* create folder structures for each destination folder */
        opnfolds(folders, foldp);
@@ -277,7 +276,6 @@ clsfolds(struct st_fold *folders, int nfolders)
 
        for (fp = folders, ep = folders + nfolders; fp < ep; fp++) {
                mp = fp->f_mp;
 
        for (fp = folders, ep = folders + nfolders; fp < ep; fp++) {
                mp = fp->f_mp;
-               seq_setprev(mp);
                seq_save(mp);
        }
 }
                seq_save(mp);
        }
 }
index b2adebf..438d854 100644 (file)
@@ -311,7 +311,6 @@ main(int argc, char **argv)
                /* parse the message range/sequence/name and set SELECTED */
                if (!m_convert(mp, msg))
                        exit(EX_SOFTWARE);
                /* 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 (mp->numsel > 1)
                        adios(EX_USAGE, NULL, "only one message at a time!");
index 5059383..7258327 100644 (file)
--- a/uip/rmm.c
+++ b/uip/rmm.c
@@ -117,7 +117,6 @@ main(int argc, char **argv)
        if (unlink_msgs) {
                /* "remove" the SELECTED messages */
                folder_delmsgs(mp, 1);
        if (unlink_msgs) {
                /* "remove" the SELECTED messages */
                folder_delmsgs(mp, 1);
-               seq_setprev(mp);
                seq_save(mp);
                folder_free(mp);
                return 0;
                seq_save(mp);
                folder_free(mp);
                return 0;
index d7691db..148c05b 100644 (file)
@@ -165,7 +165,6 @@ main(int argc, char **argv)
                                exit(EX_USAGE);
                        }
                }
                                exit(EX_USAGE);
                        }
                }
-               seq_setprev(mp);
 
                for (nmsgs = 0, msgnum = mp->lowsel;
                                msgnum <= mp->hghsel; msgnum++) {
 
                for (nmsgs = 0, msgnum = mp->lowsel;
                                msgnum <= mp->hghsel; msgnum++) {
index c56a401..740e692 100644 (file)
@@ -191,7 +191,6 @@ main(int argc, char **argv)
        for (msgnum = 0; msgnum < msgs.size; msgnum++)
                if (!m_convert(mp, msgs.msgs[msgnum]))
                        exit(EX_USAGE);
        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");
 
        if ((nmsgs = read_hdrs(mp, datesw)) <= 0)
                adios(EX_DATAERR, NULL, "no messages to sort");