* epa.el (epa-encrypt-mail): Ask a user whether to skip a
authorueno <ueno>
Fri, 5 Jan 2007 00:28:23 +0000 (00:28 +0000)
committerueno <ueno>
Fri, 5 Jan 2007 00:28:23 +0000 (00:28 +0000)
recipient whose public key is not available.

ChangeLog
epa.el

index 25edac7..e4424b7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-01-05  Daiki Ueno  <ueno@unixuser.org>
+
+       * epa.el (epa-encrypt-mail): Ask a user whether to skip a
+       recipient whose public key is not available.
+
 2007-01-04  Daiki Ueno  <ueno@unixuser.org>
 
        * epa.el (epa-decrypt-mail): Renamed from epa-decrypt.
diff --git a/epa.el b/epa.el
index 579e9a3..d5d8298 100644 (file)
--- a/epa.el
+++ b/epa.el
@@ -1050,7 +1050,7 @@ Don't use this command in Lisp programs!"
    (save-excursion
      (let ((verbose current-prefix-arg)
           (context (epg-make-context epa-protocol))
-          recipients)
+          recipients recipient-keys)
        (goto-char (point-min))
        (when (epa--mail-mode-p)
         (save-restriction
@@ -1082,14 +1082,21 @@ Don't use this command in Lisp programs!"
 If no one is selected, symmetric encryption will be performed.  "
                  recipients)
               (if recipients
-                  (delq nil
-                        (apply #'nconc
-                               (mapcar
-                                (lambda (recipient)
+                  (apply #'nconc
+                         (mapcar
+                          (lambda (recipient)
+                            (setq recipient-keys
                                   (epg-list-keys
                                    (epg-make-context epa-protocol)
                                    (concat "<" recipient ">")))
-                                recipients)))))
+                            (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)
+                          recipients))))
             (setq sign (if verbose (y-or-n-p "Sign? ")))
             (if sign
                 (epa-select-keys context