OSDN Git Service

(epa--select-keys): New function.
authorDaiki Ueno <ueno@unixuser.org>
Mon, 26 Mar 2007 08:30:08 +0000 (08:30 +0000)
committerDaiki Ueno <ueno@unixuser.org>
Mon, 26 Mar 2007 08:30:08 +0000 (08:30 +0000)
(epa-select-keys): Use it; don't popup menu if keys have elements
less than 2.

ChangeLog
epa.el

index 07dfb23..2b3132e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
 2007-03-26  Daiki Ueno  <ueno@unixuser.org>
 
-       * 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  <ueno@unixuser.org>
 
diff --git a/epa.el b/epa.el
index 569eb03..a188e46 100644 (file)
--- 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