Reverted.
[elisp/epg.git] / epa.el
diff --git a/epa.el b/epa.el
index 0c90a7c..c95480e 100644 (file)
--- a/epa.el
+++ b/epa.el
        (beginning-of-line)
        (get-text-property (point) 'epa-key))))
 
-(defun epa-select-keys (prompt &optional names)
+(defun epa-select-keys (prompt &optional names mode)
   (save-excursion
     (unless (and epa-keys-buffer
                 (buffer-live-p epa-keys-buffer))
       (erase-buffer)
       (insert prompt "\n")
       (widget-create 'link
+                    :notify (lambda (&rest ignore) (abort-recursive-edit))
+                    :help-echo
+                    (substitute-command-keys
+                     "Click here or \\[abort-recursive-edit] to cancel")
+                    "Cancel")
+      (widget-create 'link
                     :notify (lambda (&rest ignore) (exit-recursive-edit))
                     :help-echo
                     (substitute-command-keys
       (if names
          (while names
            (setq point (point))
-           (epa-list-keys-1 (car names) nil)
+           (epa-list-keys-1 (car names) mode)
            (goto-char point)
            (epa-mark)
            (goto-char (point-max))
            (setq names (cdr names)))
-       (epa-list-keys-1 nil nil))
+       (epa-list-keys-1 nil mode))
       (epa-keys-mode)
       (goto-char (point-min))
       (pop-to-buffer (current-buffer))
   (interactive "fFile: ")
   (let* ((context (epg-make-context))
         (plain (if (equal (file-name-extension file) "sig")
-                   (file-name-sans-extension file)))
-        signature)
+                   (file-name-sans-extension file))))
     (message "Verifying %s..." (file-name-nondirectory file))
     (epg-verify-file context file plain)
     (message "Verifying %s...done" (file-name-nondirectory file))
-    (setq signature (reverse (epg-context-result-for context 'verify)))
-    (while signature
-      (message "%s: %s %s %s"
-              (epg-signature-status (car signature))
-              (epg-signature-key-id (car signature))
-              (epg-signature-user-id (car signature))
-              (epg-signature-validity (car signature)))
-      (setq signature (cdr signature)))))
+    (message "%s"
+            (epg-verify-result-to-string
+             (epg-context-result-for context 'verify)))))
 
 (defun epa-sign-file (file detached)
   (interactive
 (defun epa-encrypt-file (file recipients)
   (interactive
    (list (expand-file-name (read-file-name "File: "))
-        (mapcar (lambda (key)
-                  (epg-sub-key-id
-                   (car (epg-key-sub-key-list key))))
-                (epa-select-keys "Select recipents for encryption.
-If no one is selected, symmetric encryption will be performed.  "))))
+        (epa-select-keys "Select recipents for encryption.
+If no one is selected, symmetric encryption will be performed.  ")))
   (let ((cipher (concat file ".gpg"))
        (context (epg-make-context)))
     (message "Encrypting %s..." (file-name-nondirectory file))