On Thu, Mar 01, 2001 at 12:28:56AM +0100, Christian R Molls <[EMAIL PROTECTED]> wrote: > I know that I have read about this matter before, but had no luck > searching the archives: what possibilities are there to fix that > issue? I´m thinking of a macro/script combination called from withing > mutt that deletes the misleading "In-Reply-To:" and "Reference" headers > in the mbox file that holds the thread, and makes mutt re-read the > folder, now with two separate threads. Anyone done that before? Yup. I wrote a patch to mutt to "break threads" when the subject line changes (except for things like "re:", of course). I've been running with my patch for months now. The best part is that it leaves your original messages intact, and you can toggle between the two modes if you want. I mostly use the patch because on some mailing lists people change the subject of thread that has wandered off-target, but the References and In-Reply-To fields keep the message in the same thread. Applying my patch and turning subj_breaks_thread on will put messages with different subject lines in different threads. I never did get much of a response for my patch. I've attached it if you'd like to apply it. -- Bob Bell <[EMAIL PROTECTED]> ------------------------------------------------------------------------- "In theory, theory and practice are the same. In practice, they are different." -- Larry McVoy
diff -ru -x CVS mutt-cvs/commands.c mutt/commands.c --- mutt-cvs/commands.c Wed Jun 21 05:55:24 2000 +++ mutt/commands.c Wed Sep 20 17:09:26 2000 @@ -472,6 +472,7 @@ char buffer[LONG_STRING], errbuf[SHORT_STRING]; int r; int old_strictthreads = option (OPTSTRICTTHREADS); + int old_subjnothread = option (OPTSUBJNOTHREAD); int old_sortre = option (OPTSORTRE); buffer[0] = 0; @@ -493,6 +494,7 @@ mutt_error ("%s", errbuf); } if (option (OPTSTRICTTHREADS) != old_strictthreads || + option (OPTSUBJNOTHREAD) != old_subjnothread || option (OPTSORTRE) != old_sortre) set_option (OPTNEEDRESORT); } diff -ru -x CVS mutt-cvs/init.h mutt/init.h --- mutt-cvs/init.h Tue Sep 5 11:01:09 2000 +++ mutt/init.h Wed Sep 20 16:51:39 2000 @@ -1997,6 +1997,16 @@ ** personal mailbox where you might have several unrelated messages with ** the subject ``hi'' which will get grouped together. */ + { "subj_breaks_thread", DT_BOOL, R_RESORT|R_INDEX, OPTSUBJNOTHREAD, 0 }, + /* + ** .pp + ** If set, a message that would normally be a member of a thread will + ** not be a member of that thread if the subject has changed. This is + ** useful when a message reply updates the ``References'' and/or + ** ``In-Reply-To'' fields, but the sender changes the subject line + ** with the intent to indicate that the subject of discussion has + ** changed. + */ { "suspend", DT_BOOL, R_NONE, OPTSUSPEND, 1 }, /* ** .pp diff -ru -x CVS mutt-cvs/mutt.h mutt/mutt.h --- mutt-cvs/mutt.h Fri Jul 28 15:25:58 2000 +++ mutt/mutt.h Thu Sep 21 10:27:24 2000 @@ -354,6 +354,7 @@ OPTSORTRE, OPTSTATUSONTOP, OPTSTRICTTHREADS, + OPTSUBJNOTHREAD, OPTSUSPEND, OPTTHOROUGHSRC, OPTTILDE, @@ -582,6 +583,7 @@ unsigned int display_subject : 1; /* used for threading */ unsigned int fake_thread : 1; /* no ref matched, but subject did */ unsigned int threaded : 1; /* message has been threaded */ + unsigned int subj_broke_thread : 1; /* not with thread due to subject change */ unsigned int recip_valid : 1; /* is_recipient is valid */ unsigned int active : 1; /* message is not to be removed */ diff -ru -x CVS mutt-cvs/thread.c mutt/thread.c --- mutt-cvs/thread.c Wed May 10 13:16:43 2000 +++ mutt/thread.c Thu Sep 21 11:53:28 2000 @@ -504,6 +504,7 @@ ctx->hdrs[i]->child = NULL; ctx->hdrs[i]->threaded = 0; ctx->hdrs[i]->fake_thread = 0; + ctx->hdrs[i]->subj_broke_thread = 0; } ctx->tree = NULL; } @@ -557,15 +558,37 @@ CUR->parent = NULL; insert_message (&ctx->tree, CUR, usefunc); } - else if (!CUR->threaded) + /* Check if (1) message is not yet threaded, or (2) a change in + * subject broke the thread but that option has been turned off, + * or (3) if the message is a candidate to break from the thread + * and the option is currently set + */ + else if (!CUR->threaded || + (CUR->subj_broke_thread && !option (OPTSUBJNOTHREAD)) || + (!CUR->subj_broke_thread && option (OPTSUBJNOTHREAD) && + CUR->subject_changed && CUR->parent != NULL)) { + if (CUR->threaded) + { + unlink_message (&CUR->parent->child, CUR); + CUR->parent = NULL; + } if ((tmp = find_reference (CUR, ctx)) != NULL) { - CUR->parent = tmp; if (CUR->env->real_subj && tmp->env->real_subj) CUR->subject_changed = mutt_strcmp (tmp->env->real_subj, CUR->env->real_subj) ? 1 : 0; else CUR->subject_changed = (CUR->env->real_subj || tmp->env->real_subj) ? 1 : 0; + if (CUR->subject_changed && option (OPTSUBJNOTHREAD)) + { + CUR->subj_broke_thread = 1; + tmp = NULL; + } + else + { + CUR->subj_broke_thread = 0; + CUR->parent = tmp; + } } else CUR->subject_changed = 1;