]> git.eshelyaron.com Git - emacs.git/commitdiff
Extend epa-file-select-keys to allow users to inhibit key selection.
authorDaiki Ueno <ueno@unixuser.org>
Thu, 16 Dec 2010 02:35:56 +0000 (11:35 +0900)
committerDaiki Ueno <ueno@unixuser.org>
Thu, 16 Dec 2010 02:35:56 +0000 (11:35 +0900)
* epa-file.el (epa-file-select-keys): Accept 'silent to inhibit
key selection prompt; make 'silent as default (Bug#7487).

lisp/ChangeLog
lisp/epa-file.el

index cdb98b1555100636ad33ebbdfbd691aa466d0386..892acdc752e6a75e287597fc7f815539e0c35b11 100644 (file)
@@ -1,3 +1,8 @@
+2010-12-16  Daiki Ueno  <ueno@unixuser.org>
+
+       * epa-file.el (epa-file-select-keys): Accept 'silent to inhibit
+       key selection prompt; make 'silent as default (Bug#7487).
+
 2010-12-16  Leo  <sdl.web@gmail.com>
 
        * eshell/eshell.el (eshell-directory-name): Use
index 95d8423020b633fe34152375229f7b349ede94a9..3b2663fe0e7eb45f943e40c7d5bfdb7a417ba47a 100644 (file)
@@ -35,9 +35,16 @@ way."
   :type 'boolean
   :group 'epa-file)
 
-(defcustom epa-file-select-keys nil
-  "If non-nil, always asks user to select recipients."
-  :type 'boolean
+(defcustom epa-file-select-keys 'silent
+  "Control whether or not to pop up the key selection dialog.
+
+If t, always asks user to select recipients.
+If nil, query user only when `epa-file-encrypt-to' is not set.
+If neither t nor nil, doesn't ask user.  In this case, symmetric
+encryption is used."
+  :type '(choice (const :tag "Ask always" t)
+                (const :tag "Ask when recipients are not set" nil)
+                (const :tag "Don't ask" silent))
   :group 'epa-file)
 
 (defvar epa-file-passphrase-alist nil)
@@ -218,9 +225,10 @@ way."
                         end (point-max)))
                 (epa-file--encode-coding-string (buffer-substring start end)
                                                 coding-system))
-              (if (or epa-file-select-keys
-                      (not (local-variable-p 'epa-file-encrypt-to
-                                             (current-buffer))))
+              (if (or (eq epa-file-select-keys t)
+                      (and (null epa-file-select-keys)
+                           (not (local-variable-p 'epa-file-encrypt-to
+                                                  (current-buffer)))))
                   (epa-select-keys
                    context
                    "Select recipents for encryption.