* Prahlad Vaidyanathan <[EMAIL PROTECTED]> [2001-11-28 09:44:54 +0530]: > On Sat, 17 Nov 2001 christophe <[EMAIL PROTECTED]> spewed > into the ether: > [-- snip --] > > > I should add, this works also for push commands (and it seems to > > > work for exec). I use the following in my .muttrc: folder-hook > > > "regex for all mailing list folders" "push > > > >\"<tag-pattern>~d>2w\n<untag-pattern>~F|~D\n<tag-prefix-cond><save-message>\n\n\"" > > > > > > It moves all messages older than 2 weeks except flagged ones to an > > > archive folder (I have other folder-hooks to set appropriate > > > save-hooks). > > > > This is nearly what I would like to do except that I would like to > > keep thread together. ie I would like to move thread with all mails > > older than X days, read and not flagged. > > I want to setup a macro that does this : > > 1. Tag all messages older than, say, 2 weeks > 2. Tag entire threads of those messages, even if some messages in that > thread are newer than 2 weeks. > 3. Delete/Save tagged messages. > > 1, and 3 seem possible, but 2 does not. So far I've been doing it > manually, but as I subscribe to more and more lists it becomes > increasingly tedious. > > Any solutions ?
I hope yes. I've written a patch to achieve this. It is not well tested, but it seems to work, and I had no crash after applying it. It adds an new pattern ~a. I see only two possible uses of it, "T~a\n" and "^T! ~a\n". The first one tags all messages which are in threads containing any tagged message, the second one untags all messages which are in threads containing any untagged messages. I should add that ~a and !~a are not the same module not. The not applies to the tag status of the other messages in the thread. As always, use at YOUR OWN RISK. But I would be glad to hear if anybody considers this patch usefull, or can give me any feedback. The above push command will soon be, but I have to test a bit before using it :) "push \"<tag-pattern>~d>2w\n<untag-pattern>~N|~O|~F|~D\n<untag-pattern>!~a\n<tag-prefix-cond><save-message>\n\n\"" > PS: Sorry for raking up _old_ threads, but I just desperately need this > one to work ! I hope no one gets angry with me, because of replying to e-mails after such a long time. Nicolas
written by Nicolas Rachinsky <[EMAIL PROTECTED]> http://www.rachinsky.de This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. --- mutt-1.3.27.orig/PATCHES Mon Nov 26 20:16:52 2001 +++ PATCHES Thu Dec 6 16:27:55 2001 @@ -1,0 +1 @@ +1.3.28.nr.threadcomplete --- mutt-1.3.28.ori/mutt.h Thu Mar 14 19:22:25 2002 +++ mutt.h Fri Mar 15 00:22:41 2002 @@ -198,6 +198,7 @@ M_LIMIT, M_EXPIRED, M_SUPERSEDED, + M_THREADCOMPLETE, /* actions for mutt_pattern_comp/mutt_pattern_exec */ M_AND, --- mutt-1.3.28.ori/pattern.c Thu Mar 14 19:22:26 2002 +++ pattern.c Fri Mar 15 00:23:52 2002 @@ -50,6 +50,7 @@ } Flags[] = { + { 'a', M_THREADCOMPLETE, 0, NULL }, { 'A', M_ALL, 0, NULL }, { 'b', M_BODY, M_FULL_MSG, eat_regexp }, { 'B', M_WHOLE_MSG, M_FULL_MSG, eat_regexp }, @@ -957,6 +958,27 @@ return alladdr; } +static int match_threadcomplete(int flag,THREAD *t,int left,int up,int right,int down) +{ + int a=0; + HEADER *h=NULL; + + if(! t)return 0; + h=t->message; + if(! flag && h && h->tagged)return 1; + if(flag && h && ! h->tagged) return 1; + + if(up)a=match_threadcomplete(flag,t->parent,1,1,1,0); + if(a)return a; + if(right && t->parent)a=match_threadcomplete(flag,t->next,0,0,1,1); + if(a)return a; + if(left && t->parent)a=match_threadcomplete(flag,t->prev,1,0,0,1); + if(a)return a; + if(down)a=match_threadcomplete(flag,t->child,1,0,1,1); + if(a)return a; + return 0; +} + /* flags M_MATCH_FULL_ADDRESS match both personal and machine address */ int @@ -1053,6 +1075,8 @@ return (pat->not ^ (h->env->x_label && regexec (pat->rx, h->env->x_label, 0, NULL, 0) == 0)); case M_DUPLICATED: return (pat->not ^ (h->thread && h->thread->duplicate_thread)); + case M_THREADCOMPLETE: + return ((h->thread && match_threadcomplete(pat->not,h->thread,1,1,1,1))); } mutt_error (_("error: unknown op %d (report this error)."), pat->op); return (-1);