Jumping in here, I have modified the previously posted code here to provide me with a more complete solution.
With the attach code, I can: * automatically encrypt mails if all recipients have a *valid* public key. The previous patch allowed encryption if a key existed but was revoked, which cause a weird UX issue where the user would be bothered with "No public key for..." * not have specify if i want to encrypt the mail or not: it is encrypted if possible * try to autodetect (by running the function directly) if the mail will be crypted and signed or just signed before sending * explicitely request the mail to be encrypted or just signed, if I want to, using the usual keybindings (ie. the existing #secure tags are respected) So basically, this replaces the common hook: (add-hook 'message-setup-hook 'mml-secure-sign-pgpmime) with this: (add-hook 'message-send-hook 'anarcat/message-set-encryption) The rationale behind this technique is that the setup-hook runs when recipients are not yet defined so it will always set the mail to be only signed, even though your final recipients should be crypted. An alternative would be for notmuch to prompt the To: header before setting up the buffer ("à la" Mutt), but I didn't feel like going that way. Code is attached. Obviously, those function names would change if they would be to integrate into notmuch. ;)
Opportunistic encryption, here we go. a. -- Evil exists to glorify the good. Evil is negative good. It is a relative term. Evil can be transmuted into good. What is evil to one at one time, becomes good at another time to somebody else. - Sivananda
Description: PGP signature
_______________________________________________ notmuch mailing list email@example.com http://notmuchmail.org/mailman/listinfo/notmuch