Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id B8B27429E3D for ; Wed, 4 Jan 2012 00:36:53 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id K8UNJWirFwCB for ; Wed, 4 Jan 2012 00:36:53 -0800 (PST) Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 0B076431FD0 for ; Wed, 4 Jan 2012 00:36:52 -0800 (PST) Received: by wgbds13 with SMTP id ds13so23777535wgb.2 for ; Wed, 04 Jan 2012 00:36:50 -0800 (PST) Received: by 10.227.5.208 with SMTP id 16mr29830384wbw.17.1325666210507; Wed, 04 Jan 2012 00:36:50 -0800 (PST) Received: from hotblack-desiato.hh.sledj.net (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25]) by mx.google.com with ESMTPS id ex2sm12791691wib.1.2012.01.04.00.36.48 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 04 Jan 2012 00:36:48 -0800 (PST) Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000) id B770DA053A; Wed, 4 Jan 2012 08:36:46 +0000 (GMT) To: Jameson Graef Rollins , Gregor Zattler , Notmuch Mail Subject: Re: Emacs: Crypto: How to get automatic encryption? In-Reply-To: <87fwfw8npx.fsf@servo.finestructure.net> References: <20120103195651.GA27869@shi.workgroup> <87fwfw8npx.fsf@servo.finestructure.net> User-Agent: Notmuch/0.10.2+151~gbf1dc2b (http://notmuchmail.org) Emacs/24.0.92.1 (x86_64-pc-linux-gnu) From: David Edmondson Date: Wed, 04 Jan 2012 08:36:39 +0000 Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 08:36:53 -0000 --=-=-= Content-Type: text/plain On Tue, 03 Jan 2012 13:45:14 -0800, Jameson Graef Rollins wrote: > Any other suggestions? In the function that I add to `message-send-hook' I do the following: (message-goto-body) ;; 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 (mapc (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")))) t) nil)) (I'd probably re-write that to use a cl loop now - it's very old.) --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk8ED5cACgkQaezQq/BJZRbpowCeIdRN9kOc1Auzu8ApXwF5H08k alcAniDq6DKp8v9u4mYFw+6oK5IW6R09 =6wX5 -----END PGP SIGNATURE----- --=-=-=--