# HG changeset patch # User Daiki Ueno # Date 1292466956 -32400 # Node ID c6bcd9fc6536c158e7bdb259d7971cc01b927834 # Parent fbefd9a68046211f1e5023feb564df8d507a1b95 Extend epa-file-select-keys to allow users to inhibit key selection. * epa-file.el (epa-file-select-keys): Accept 'silent to inhibit key selection prompt; make 'silent as default (Bug#7487). diff -r fbefd9a68046 -r c6bcd9fc6536 lisp/ChangeLog --- a/lisp/ChangeLog Thu Dec 16 10:28:33 2010 +0800 +++ b/lisp/ChangeLog Thu Dec 16 11:35:56 2010 +0900 @@ -1,3 +1,8 @@ +2010-12-16 Daiki Ueno + + * epa-file.el (epa-file-select-keys): Accept 'silent to inhibit + key selection prompt; make 'silent as default (Bug#7487). + 2010-12-16 Leo * eshell/eshell.el (eshell-directory-name): Use diff -r fbefd9a68046 -r c6bcd9fc6536 lisp/epa-file.el --- a/lisp/epa-file.el Thu Dec 16 10:28:33 2010 +0800 +++ b/lisp/epa-file.el Thu Dec 16 11:35:56 2010 +0900 @@ -35,9 +35,16 @@ :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 @@ 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.