From: ueno Date: Mon, 26 Mar 2007 08:30:08 +0000 (+0000) Subject: (epa--select-keys): New function. X-Git-Tag: epg-0_0_11~12 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=10906bf1723b4dd544c8f6e24d9bc3f81e7e3874;p=elisp%2Fepg.git (epa--select-keys): New function. (epa-select-keys): Use it; don't popup menu if keys have elements less than 2. --- diff --git a/ChangeLog b/ChangeLog index 07dfb23..2b3132e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,10 @@ 2007-03-26 Daiki Ueno - * epa.el (epa--insert-keys): Changed arglist. All callers changed. + * epa.el (epa--insert-keys): Changed arglist. All callers + changed. + (epa--select-keys): New function. + (epa-select-keys): Use it; don't popup menu if keys have elements + less than 2. 2007-03-25 Daiki Ueno diff --git a/epa.el b/epa.el index 569eb03..a188e46 100644 --- a/epa.el +++ b/epa.el @@ -424,14 +424,7 @@ If ARG is non-nil, mark the current line." (if key (list key)))))) -;;;###autoload -(defun epa-select-keys (context prompt &optional names secret) - "Display a user's keyring and ask him to select keys. -CONTEXT is an epg-context. -PROMPT is a string to prompt with. -NAMES is a list of strings to be matched with keys. If it is nil, all -the keys are listed. -If SECRET is non-nil, list secret keys instead of public keys." +(defun epa--select-keys (prompt keys) (save-excursion (unless (and epa-keys-buffer (buffer-live-p epa-keys-buffer)) @@ -458,7 +451,7 @@ If SECRET is non-nil, list secret keys instead of public keys." "Click here or \\[exit-recursive-edit] to finish") "OK") (insert "\n\n") - (epa--insert-keys (epg-list-keys context name secret)) + (epa--insert-keys keys) (widget-setup) (set-keymap-parent (current-local-map) widget-keymap) (setq epa-exit-buffer-function #'abort-recursive-edit) @@ -472,6 +465,19 @@ If SECRET is non-nil, list secret keys instead of public keys." (delete-window (get-buffer-window epa-keys-buffer))) (kill-buffer epa-keys-buffer)))) +;;;###autoload +(defun epa-select-keys (context prompt &optional names secret) + "Display a user's keyring and ask him to select keys. +CONTEXT is an epg-context. +PROMPT is a string to prompt with. +NAMES is a list of strings to be matched with keys. If it is nil, all +the keys are listed. +If SECRET is non-nil, list secret keys instead of public keys." + (let ((keys (epg-list-keys context name secret))) + (if (> (length keys) 1) + (epa--select-keys prompt keys) + keys))) + (defun epa--format-fingerprint-1 (fingerprint unit-size block-size) (let ((unit 0)) (with-temp-buffer