<<< Date Index >>>     <<< Thread Index >>>

Re: folder-hook in my .muttrc doesn't work



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday, June  2 at 09:39 PM, quoth Rudolf Bahr:
>> On Monday, June  2 at 12:29 PM, quoth Rudolf Bahr:
>>> folder-hook     +fanciulla/lisa       'set use_from=no'
>>> folder-hook     +fanciulla/lisa       'unmy_hdr *'
>>> folder-hook     +fanciulla/lisa       'my_hdr     From: 
>>> thats-me@xxxxxxxxxxxxx'
>> Those three should work fine.
> Sorry, they don't, in this case, at least. The From: address is 
> still a combination of my username and PC's hostname.

Hmmm.... In that case, I'm not sure. Let's try something different to 
see if this works (all one line, of course):

     send-hook '~C lisa@xxxxxxxxxxxxx' 'my_hdr From:
     thats-me@xxxxxxxxxxxxx'

>>      folder-hook +fanciulla/lisa 'set record="=fanciulla/lisa"'
>
>
> Ok, I removed the folder-hooks which can't be preset by me and are 
> indeed unnecessary. Instead I added as you suggested:
>
> folder-hook +fanciulla/lisa 'set record="=fanciulla/lisa"'
>
> But Mutt gives me still back: '=lisa@xxxxxxxxxxxxx' instead of 
> '=fanciulla/lisa'.

Very interesting. That's not a typical mutt-default Fcc, so I suspect 
you have other hooks in your configuration that are re-setting it... 
particularly fcc-hooks or fcc-save-hooks.

>> *answer* email (r), as opposed to compose new email (m)? If you're 
>> *replying* to email (r), then the recipient (To:) is set based on 
>> the message you're replying to.
>> 
>> What exactly are you trying to achieve?
>
> I'm entering the folder 'fanciulla/lisa' in order to answer a message 
> there by 'r' or ',a'.

Well, I guess my point is... I generally prefer using send-hooks (or 
reply-hooks) instead of folder-hooks for changing these sorts of 
settings, because they allow me to have the message anywhere, and get 
triggered for every message (thus, they over-rule folder-hooks). 
Often, the only reason people choose to use folder-hooks is because 
they haven't yet discovered send-hooks. On the other hand, some people 
strongly associate a given folder with a given role, and associating 
folder with sending address (for example) makes more sense in their 
head.

I would have done something like this:

     alias -group lisagroup lisa Lisa Lady <lisa@xxxxxxxxxxxxx>
     set use_from=no
     send-hook '%C lisagroup' 'my_hdr From: thats-me@xxxxxxxxxxxxx'
     fcc-save-hook '%C lisagroup' +fanciulla/lisa
     # Reply-To isn't usually useful

Note that the send-hook and fcc-save-hook trigger whenever I send a 
message to lisa regardless of what folder I'm in. The $use_from 
setting stays the same always, unless I add hooks to change it (in 
which case it'll have to go into a hook as well). The use of a group 
means I can later add addresses for lisa (e.g. 'group -group lisagroup 
- -addr lisa@xxxxxxxxxxx') and not have to change my hooks.

Without the "group" bit, that would be rewritten as:

     alias lisa Lisa Lady <lisa@xxxxxxxxxxxxx>
     set use_from=no
     send-hook '~C lisa@xxxxxxxxxxxxx' 'my_hdr From:
     thats-me@xxxxxxxxxxxxx'
     fcc-save-hook '~C lisa@xxxxxxxxxxxxx' +fanciulla/lisa
     # Reply-To isn't usually useful

>> Keep in mind, these hooks are only triggered when you enter the 
>> folder. If you have other hooks that override them (such as 
>> send-hooks or reply-hooks or message-hooks), they will not be 
>> re-triggered until you re-enter the folder.
>
> Yes, therefore I commented all other lines which have something to 
> do with 'lisa' or '=fanciulla/lisa'. It seems to help nothing.

Depending on your configuration, you may have plenty of "default" 
hooks that don't contain the text "lisa", but apply anyway. For 
example the patterns "~A" and "." in send/reply/message/display-hooks 
will match your emails... there may be lots more hooks being triggered 
than you're aware of. I'd start by following the debug steps outlined 
here: http://wiki.mutt.org/?DebugConfig

This is why I usually recommend that, once you start getting serious 
about configuring your own mutt, you start your own muttrc from 
scratch. It'll take some time to read the descriptions of all the 
relevant settings, but it's *well* worth your time.

> Kyle, many thanks for your answer with the explanations!

Happy to help!

~Kyle
- -- 
If we knew what it was we were doing, it would not be called research, 
would it?
                                               -- Albert Einstein, 1941
-----BEGIN PGP SIGNATURE-----
Comment: Thank you for using encryption!

iEYEARECAAYFAkhEU64ACgkQBkIOoMqOI172lQCcDYXz+ht0y1WnmxgK4UYQQ2zb
KJUAoPlsoVLonvGYQ0Ifi5pXd4tBZTYR
=Z/PN
-----END PGP SIGNATURE-----