On Tue, 03 Jan 2012 13:45:14 -0800, Jameson Graef Rollins 
<jroll...@finestructure.net> wrote:
> Any other suggestions?

In the function that I add to `message-send-hook' I do the following:

        ;; If already set, don't override.
        (if (not (looking-at (regexp-quote "<#secure ")))
            ;; If we can encrypt, do so, else just sign.
            (if (and encrypt (dme:message-determine-encryption))
                (insert "<#secure method=pgpmime mode=signencrypt>\n")
              (insert "<#secure method=pgpmime mode=sign>\n"))))

Where `dme:message-determine-encryption' is:

(defun dme:message-determine-encryption ()
  "Return `t' if we have gpg public keys for all recipients of
this message."
  (require 'pgg)
  (if (not (message-news-p)) ; No encryption for news.
      (catch :exit
         (lambda (addr)
           (if (not (pgg-lookup-key (downcase (mail-strip-quoted-names addr))))
               (throw :exit nil)))
         (message-tokenize-header (concat
                                   (message-fetch-field "to")
                                   (message-fetch-field "cc"))))

(I'd probably re-write that to use a cl loop now - it's very old.)

Attachment: pgprqlUJdFWCW.pgp
Description: PGP signature

notmuch mailing list

Reply via email to