Remove auto-autoloads.el~
[elisp/epg.git] / epa.el
diff --git a/epa.el b/epa.el
index 61b26fa..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)
-    (setq signature (reverse (epg-context-result-for context 'verify)))
-    (with-output-to-temp-buffer "*epa-verify-file*"
-      (set-buffer standard-output)
-      (while signature
-       (insert (format "%s: %s %s %s\n"
-                       (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))))
-    (shrink-window-if-larger-than-buffer
-     (get-buffer-window "*epa-verify-file*"))
-    (message "Verifying %s...done" (file-name-nondirectory file))))
+    (message "Verifying %s...done" (file-name-nondirectory file))
+    (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))
@@ -493,7 +486,7 @@ If no one is selected, symmetric encryption will be performed.  "))))
   (interactive "fFile: ")
   (let ((context (epg-make-context)))
     (message "Importing %s..." (file-name-nondirectory file))
-    (epg-import-keys context file)
+    (epg-import-keys-from-file context (expand-file-name file))
     (apply #'epa-list-keys epa-list-keys-arguments)
     (message "Importing %s...done" (file-name-nondirectory file))))
 
@@ -505,7 +498,7 @@ If no one is selected, symmetric encryption will be performed.  "))))
        (error "No keys selected"))
      (setq default-name
           (expand-file-name
-           (concat (epg-sub-key-id (epg-key-sub-key-list (car keys)))
+           (concat (epg-sub-key-id (car (epg-key-sub-key-list (car keys))))
                    ".gpg")
            default-directory))
      (list keys
@@ -518,7 +511,7 @@ If no one is selected, symmetric encryption will be performed.  "))))
             default-name)))))
   (let ((context (epg-make-context)))
     (message "Exporting to %s..." (file-name-nondirectory file))
-    (epg-export-keys context keys file)
+    (epg-export-keys-to-file context keys file)
     (message "Exporting to %s...done" (file-name-nondirectory file))))
 
 (provide 'epa)