On Sat, Sep 22, 2001 at 11:59:48PM -0400, David T-G wrote:
> 
> [...]
> % This doesn?t work as sendhooks seem to take precedence over
> % folderhooks.  Just an assumption.
> 
> Well, yes and no; a folder-hook gets executed whenever you
> enter a matching folder, while a send-hook gets executed
> whenever you send a matching email.
> 
> Have you tried defining a folder-hook that redefines your
> send-hook?

        ------- begin hooks file -------
unhook *

send-hook .     'unset signature'

folder-hook .   'exec   collapse-all'

[1] send-hook . 'set signature=~/.muttcf/signature/sig-all'

[2] send-hook \
.*@*\.(ar|es|cl|co|cu|cr|ho|mx|pe|ph|uy|ve|it|pt|br)$   \
'set signature=~/.muttcf/signature/sig-esp'

[3] send-hook .*@*\.(com|org|edu|)$     \
'set signature=~/.muttcf/signature/sig-misc'

[4] send-hook ^majordomo@* 'set signature=""'
[5] send-hook .*-(request|(un)?subscribe|list-admin)@*  \
'set signature=""'

[6] folder-hook box\.uni        'unhook send-hook'

[7] folder-hook box\.uni        \
'set signature=~/.muttcf/signature/sig-uni'
        ------- end hooks file -------


Now I enter any box and the signature is set according to the
address (sig-es, sig-misc ... or sig-all if there is no
match).  Then, if it�s a, say, majordomo@ address, the
signature is not included.  Next, I go into folder box.uni
and the signature included is sig-uni.

So far so good.  BUT if I now leave box.uni and compose a
message to any address, I expect to use one of [1, 2, 3, 4,
or 5] depending on the address.  Instead, [7] is used.


Ok, now it works.  I�ve added a "folder-hook" to [1, 2, 3, 4
and 5].  Not sure if this will get trickier as I add more
hooks, but for now it suffices.  Here is the diff for the
changes against the above hooks:


--- hooks.old   Sun Sep 23 10:37:51 2001
+++ hooks.new   Sun Sep 23 10:39:49 2001
@@ -5,17 +5,18 @@
 
 folder-hook .  'exec   collapse-all'
 
-[1] send-hook .        'set signature=~/.muttcf/signature/sig-all'
+[1] foder-hook .       send-hook .     \
+'set signature=~/.muttcf/signature/sig-all'
 
-[2] send-hook \
+[2] folder-hook .      send-hook \
 .*@*\.(ar|es|cl|co|cu|cr|ho|mx|pe|ph|uy|ve|it|pt|br)$  \
 'set signature=~/.muttcf/signature/sig-esp'
 
-[3] send-hook .*@*\.(com|org|edu|)$    \
+[3] folder-hook .      send-hook .*@*\.(com|org|edu|)$ \
 'set signature=~/.muttcf/signature/sig-misc'
 
-[4] send-hook ^majordomo@* 'set signature=""'
-[5] send-hook .*-(request|(un)?subscribe|list-admin)@* \
+[4] folder-hook .      send-hook ^majordomo@* 'set signature=""'
+[5] folder-hook .      send-hook .*-(request|(un)?subscribe|list-admin)@*      \
 'set signature=""'
 
 [6] folder-hook box\.uni       'unhook send-hook'


Thank You,
-- 
Horacio

Reply via email to