Hi,

At  1:24 PM EDT on April 23 David T-G sent off:
> > I would like to have mutt automatically mark certain messages as deleted in
> > my
> ...
> > So how can I do three levels of quoting?  Is it possible, and is there a
> > way I can avoid it?
> 
> Rather than just escaping your single quotes because you're using single
> quotes already, you have to escape them "deeply" enough.  Starting from
> the inside out, what you want is effectively
> 
>   ~b '^SPAM ...'
> 
> and so you pass that pattern to delete-pattern.  Now, you can skip the
> double quotes, because D takes a "pattern specifier" like ~b and the
> pattern itself (which must be quoted if it includes spaces); I just tried
> that in my mailbox and no means of wrapping the ~b with the pattern
> was acceptable.  So now you have
> 
>   D~b '^SPAM...'
> 
> and you want to put that in a folder-hook.  You must protect the quotes
> if they will be interpolated, so you wrap the whole thing in another
> layer like
> 
>   push "D~b '^SPAM...'"
> 
> to make it work (though that part is untested).

:-P  Always test!  I had already tried that, and it doesn't work even though it
should.  Of course, testing is a pain since it means restarting mutt to undo
the bad folder-hooks.

> Meanwhile, generally the way to escape embedded quotes is to not just
> escape the quote but also escape your escape char, since the first pass
> over the line (the folder-hook level) will not only remove the outer set
> of quotes (doubles above) but also take literally any escaped characters
> and get rid of your escaping -- but that's usually too early!  It can be

It was an escaping problem, although I thought I'd tried that with \\!  But
noooo!  The second \ needs to be escaped so it has to be \\\\!  The working
hook: 

folder-hook spam push 'D"~b \"^^SPAM: Hit\\\\! \\\\(1 point\\\\)     BODY: Image tag 
with an ID code to identify you\"\n"'

Note the different escaping method for ^.

Hopefully some other SpamAssassin users will find this helpful.

-- 
Faith, n. Belief without evidence in what is told by one who speaks without
knowledge, of things without parallel. - A. Bierce, The Devil's Dictionary
Robert I. Reid | PGP/GPG Keys: http://astro.utoronto.ca/~reid/pgp.html

Reply via email to