From: ueno Date: Fri, 5 Jan 2007 00:34:43 +0000 (+0000) Subject: * pgg-epg.el (pgg-epg-encrypt-region): Ask a user whether to skip a X-Git-Tag: epg-0_0_10~18 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=457d4019672859aab6ba0f2c77bf13423d2b6d30;p=elisp%2Fepg.git * pgg-epg.el (pgg-epg-encrypt-region): Ask a user whether to skip a recipient whose public key is not available. --- diff --git a/ChangeLog b/ChangeLog index e4424b7..2b15539 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2007-01-05 Daiki Ueno + * pgg-epg.el (pgg-epg-encrypt-region): Ask a user whether to skip a + recipient whose public key is not available. * epa.el (epa-encrypt-mail): Ask a user whether to skip a recipient whose public key is not available. diff --git a/pgg-epg.el b/pgg-epg.el index 86c6155..16fe555 100644 --- a/pgg-epg.el +++ b/pgg-epg.el @@ -65,7 +65,7 @@ If optional PASSPHRASE is not specified, it will be obtained from the passphrase cache or user." (let ((context (epg-make-context)) (inhibit-redisplay t) ;Gnus users don't like flickering - cipher) + cipher recipient-keys) (epg-context-set-armor context t) (epg-context-set-textmode context pgg-text-mode) (epg-context-set-passphrase-callback context #'pgg-epg-passphrase-callback) @@ -76,15 +76,24 @@ passphrase cache or user." (erase-buffer)) (condition-case error (setq cipher - (epg-encrypt-string context - (buffer-substring start end) - (mapcar - (lambda (recipient) - (car (epg-list-keys context recipient))) - (if pgg-encrypt-for-me - (cons pgg-default-user-id recipients) - recipients)) - sign t) + (epg-encrypt-string + context + (buffer-substring start end) + (apply #'nconc + (mapcar + (lambda (recipient) + (setq recipient-keys + (epg-list-keys context recipient)) + (unless (or recipient-keys + (y-or-n-p + (format "No public key for %s; skip it? " + recipient))) + (error "No public key for %s" recipient)) + recipient-keys) + (if pgg-encrypt-for-me + (cons pgg-default-user-id recipients) + recipients))) + sign t) pgg-epg-secret-key-id-list nil) (error (while pgg-epg-secret-key-id-list