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

Re: send-hook not working



On 2008-04-13, Gary Johnson <garyjohn@xxxxxxxxxxxxxxx> wrote:
> On 2008-04-13, Rejo Zenger <mutt-users@xxxxxxxxxxxxxxx> wrote:
> > ++ 13/04/08 20:53 +0200 - Kirill Miazine:
> > >>>If this one is removed, it works. I am wondering why I put that line
> > >>>there in the first place. So, now running without this line and see
> > >>>what else is broken. :)
> > >>
> > >>iirc, hooks act on the first match found.
> > >
> > >This is not actually true for *all* hooks, but this is true for some,
> > >e.g. mbox-hook.
> > 
> > Correctly. I had this order:
> > 
> >   folder-hook .                       unhook send-hook
> >   send-hook .                 "unset pgp_autoencrypt"
> >   send-hook '^~C <address>    "set pgp_autoencrypt=yes"
> > 
> > With the first one, it doesn't work. Without the first line, it does. I 
> > am still *first* setting the default and have that default overruled by 
> > more specific situations. 
> 
> The trouble with that set of hooks is that the first time you change 
> to a new folder, the two send-hooks will be unhooked.  If you are 
> going to use a folder-hook to unhook your send-hooks, you should use 
> folder-hooks to set them as well.  For example:
> 
>    folder-hook .   unhook send-hook
>    folder-hook .   send-hook .                 "unset pgp_autoencrypt"
>    folder-hook .   send-hook '^~C <address>    "set pgp_autoencrypt=yes"

Oops.  That may not be properly quoted.  The folder-hook pattern
needs to be followed by a single command, so if the command string
contains spaces, it needs to be in quotes.  I think this is correct:

   folder-hook .   'unhook send-hook'
   folder-hook .   'send-hook .                 "unset pgp_autoencrypt"'
   folder-hook .   'send-hook "^~C <address>"   "set pgp_autoencrypt=yes"'

Regards,
Gary