Re: Macro -> procmail recipe
On Mon, Jun 05, 2006 at 12:57:48PM +1000, Cameron Simpson wrote:
> On 04Jun2006 03:16, George <d1945@xxxxxxxxxxxxx> wrote:
> | On Sat, Jun 03, 2006 at 07:26:00PM -0400, Dave Waxman wrote:
> | > I find myself ignoring the same threads in mailings lists constantly.
> [...]
> | # the subject line
> | my $boringthread;
> |
> | while (<>) {
> | if ( /^\s*Subject:\s*(.*)/ ) {
> | $boringthread = $1;
> | }
> | }
> |
> | open (FILE, ">>$procmailrc") or die "Flaming death! $!\n";
> | print FILE "$comment $date";
> | print FILE ":0\n";
> | print FILE "* ^Subject: $boringthread\n";
> | print FILE "/dev/null\n\n";
>
> Wouldn't it be better to be more picky? Your script will pull _every_
> line in the message that even loosely resembles a Subject: line.
I was about to say that I had thought of that, but because there's no
B/b flag in the procmail recipe and only a single 'Subject:' line in the
headers ... but that's backwards, isn't it? Or upside down. Or maybe
both.
> How about:
>
> while (<>) {
> chomp;
> exit 0 if ! length; # end of headers
> # presumably no subject line at all
>
> if (/^subject:\s+/i) {
> ... append to .procmailrc ...
> exit(0);
> }
> }
>
I think /^Subject:\s+(.*)/ would work better.
> Faster on big messages, since it only reads the headers.
> Guarrenteed to only add one recipe to the procmailrc.
Thanks for the correction. I think without editing the end result
(making the script interactive, pulling up the rc file in an editor,
etc.), this isn't a problem-free approach, but if it provides benefit to
the OP as is, then I guess it's all good. If not, there's always the
more traditional
folder-hook . 'push <collapse-all>'
Regards.
--
George