Re: send-hooks
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thursday, May 11 at 04:50 PM, quoth gerases@xxxxxxxxxxxxxxxxxxxxx:
> My send hook is very simple: send-hook ~l 'my_hdr From: user@host'.
> That is, I want to change my from address anytime I'm sending
> anything to a known mailing list.
Sounds good.
> My lists are defined as follows:
>
> lists vim* mutt* fluxbox*
>
> subscribe vim*
> subscribe mutt*
> subscribe fluxbox*
That's valid syntax, but I see two things about it that are... unwise.
First, you don't need to define BOTH lists and subscribe. "lists" are
for lists you are not subscribed to, and "subscribe" is for lists you
are subscribed to. Having both defined *shouldn't* create a problem...
but it's not very useful, and might be confusing mutt.
Second, you're being too general with your patterns. It's best to be
very strict. With the patterns you've defined up there, for example,
mail to levi@xxxxxxxxxxx would be considered mail to a mailing list
because it has the "vi" string in it.
> 1. When I compose a message to just vim@xxxxxxx, it works. When it's
> vim-something@xxxxxxx, it doesn't. Also, it doesn't work for either
> mutt or fluxbox.
Well, that's odd, but not for the reason you think. Consider: these
are *regular expressions*, not shell globs. The pattern 'vim*' matches
any string with vi and zero or more m's. What you probably want is
something like this:
subscribe '^vim(-.*)?@vim.org$'
But as to why your current setup (vim*) doesn't match it
(vim-foo@xxxxxxx)? I don't know. I would think if anything your
pattern match there would match too much stuff.
> 2. When it does work, the "From: " value remains changed for all other
> messages.
This is expected behavior. Hooks are interesting creatures because
they trigger mutt commands, which can do just about anything. As such,
they don't maintain some sort of universal previous state to revert to
as soon as you are out of the context that the hook applies to. So
what you want to do is set a default hook, like this:
send-hook . 'my_hdr From: me@xxxxxxxx'
send-hook ~l 'my_hdr From: lists@xxxxxxxx'
What that will do is for every message that is not a known mailing
list, your from address will be me@xxxxxxxx, but for messages that are
known mailing lists, your from address will be lists@xxxxxxxxx
You can do the same thing for *every* mutt setting and *any* mutt
command. For example:
send-hook . 'subscribe ^foo$'
send-hook '~C fred@xxxxxxx' 'unsubscribe ^foo$'
~Kyle
- --
They say marriages are made in Heaven. But so is thunder and
lightning.
-- Clint Eastwood
-----BEGIN PGP SIGNATURE-----
Comment: Thank you for using encryption!
iD8DBQFEY73fBkIOoMqOI14RAiHGAKC4MDlZ1mo310idsGzQr99C56pK5wCg3B3x
17mDG4EhhyAUzxw3yRUeOAU=
=VfNI
-----END PGP SIGNATURE-----