]> git.eshelyaron.com Git - emacs.git/commitdiff
When recipient has no public key, make offer to skip it optional.
authorRichard M Stallman <rms@gnu.org>
Wed, 30 Sep 2020 22:44:42 +0000 (18:44 -0400)
committerRichard Stallman <rms@gnu.org>
Wed, 30 Sep 2020 22:44:42 +0000 (18:44 -0400)
* epa-mail.el (epa-mail-offer-skip): New option.
(epa-mail-encrypt): If epa-mail-offer-skip is nil,
don't offer to skip a keyless recipient, just cause error.

lisp/epa-mail.el

index 6e6c0a498d2d382ad92541acbfb35325460e6ae1..3ad4da16c890f2602f4c2952b3c39eae37d269ff 100644 (file)
 (defvar epa-mail-mode-on-hook nil)
 (defvar epa-mail-mode-off-hook nil)
 
+(defcustom epa-mail-offer-skip t
+  "If non-nil, when a recipient has no key, ask whether to skip it.
+Otherwise, signal an error."
+  :type 'boolean
+  :version "28.1"
+  :group 'epa-mail)
+
 ;;;###autoload
 (define-minor-mode epa-mail-mode
   "A minor-mode for composing encrypted/clearsigned mails."
@@ -218,10 +225,12 @@ If no one is selected, symmetric encryption will be performed.  "
                                  recipient))
                               'encrypt)))
                         (unless (or recipient-key
-                                    (y-or-n-p
-                                     (format
-                                      "No public key for %s; skip it? "
-                                      recipient)))
+                                     (and epa-mail-offer-skip
+                                         (y-or-n-p
+                                           (format
+                                            "No public key for %s; skip it? "
+                                            recipient)))
+                                     )
                           (error "No public key for %s" recipient))
                         (if recipient-key (list recipient-key))))
                       default-recipients)))))