unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Edmondson <dme@dme.org>
To: Jameson Graef Rollins <jrollins@finestructure.net>,
	Gregor Zattler <telegraph@gmx.net>,
	Notmuch Mail <notmuch@notmuchmail.org>
Subject: Re: Emacs: Crypto: How to get automatic encryption?
Date: Wed, 04 Jan 2012 08:36:39 +0000	[thread overview]
Message-ID: <cunk4576ezs.fsf@hotblack-desiato.hh.sledj.net> (raw)
In-Reply-To: <87fwfw8npx.fsf@servo.finestructure.net>

[-- Attachment #1: Type: text/plain, Size: 1112 bytes --]

On Tue, 03 Jan 2012 13:45:14 -0800, Jameson Graef Rollins <jrollins@finestructure.net> 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.)

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

  parent reply	other threads:[~2012-01-04  8:36 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-03 19:56 Emacs: Crypto: How to get automatic encryption? Gregor Zattler
2012-01-03 21:45 ` Jameson Graef Rollins
2012-01-04  0:08   ` Gregor Zattler
2012-01-04  8:36   ` David Edmondson [this message]
2012-01-04  8:48     ` David Edmondson
2012-01-15 22:27       ` Gregor Zattler
2012-01-17  4:48         ` Antoine Beaupré
2012-01-17  9:19           ` David Edmondson
2012-01-17 16:12             ` Antoine Beaupré
2012-01-24 21:34             ` micah anderson
2012-01-25  0:10               ` Jameson Graef Rollins
2012-01-25  6:23                 ` David Edmondson
2012-01-25  9:26                   ` Jameson Graef Rollins
2012-01-25 10:20                     ` David Edmondson
2012-01-25 17:45                       ` Jameson Graef Rollins
2012-01-25 19:09                         ` Daniel Kahn Gillmor
2012-01-26  8:53                         ` David Edmondson
2012-01-17 15:39           ` David Edmondson
2012-01-12 18:41   ` Jameson Graef Rollins
2012-01-12 19:05     ` Gregor Zattler
2012-01-12 19:28       ` Jameson Graef Rollins
2012-01-12 19:29       ` Darren McGuicken

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cunk4576ezs.fsf@hotblack-desiato.hh.sledj.net \
    --to=dme@dme.org \
    --cc=jrollins@finestructure.net \
    --cc=notmuch@notmuchmail.org \
    --cc=telegraph@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).