(epa-decrypt-file): Display output file name on completion.
[elisp/epg.git] / epa.el
diff --git a/epa.el b/epa.el
index 8036040..2044980 100644 (file)
--- a/epa.el
+++ b/epa.el
@@ -247,13 +247,11 @@ the separate window."
        truncate-lines t
        buffer-read-only t)
   (use-local-map epa-keys-mode-map)
-  (set-keymap-parent (current-local-map) widget-keymap)
   (make-local-variable 'font-lock-defaults)
   (setq font-lock-defaults '(epa-font-lock-keywords t))
   ;; In XEmacs, auto-initialization of font-lock is not effective
   ;; if buffer-file-name is not set.
   (font-lock-set-defaults)
-  (widget-setup)
   (make-local-variable 'epa-exit-buffer-function)
   (run-hooks 'epa-keys-mode-hook))
 
@@ -345,7 +343,9 @@ If ARG is non-nil, mark the current line."
                         (point-max)))
       (goto-char point))
     (epa-insert-keys context name mode)
-    (epa-keys-mode))
+    (epa-keys-mode)
+    (widget-setup)
+    (set-keymap-parent (current-local-map) widget-keymap))
   (make-local-variable 'epa-list-keys-arguments)
   (setq epa-list-keys-arguments (list name mode protocol))
   (goto-char (point-min))
@@ -436,6 +436,8 @@ If SECRET is non-nil, list secret keys instead of public keys."
                  (epa-mark)))
          (epa-insert-keys context nil nil)))
       (epa-keys-mode)
+      (widget-setup)
+      (set-keymap-parent (current-local-map) widget-keymap)
       (setq epa-exit-buffer-function #'abort-recursive-edit)
       (goto-char (point-min))
       (pop-to-buffer (current-buffer)))
@@ -582,7 +584,8 @@ If SECRET is non-nil, list secret keys instead of public keys."
                                       #'epa-progress-callback-function)
     (message "Decrypting %s..." (file-name-nondirectory file))
     (epg-decrypt-file context file plain)
-    (message "Decrypting %s...done" (file-name-nondirectory file))
+    (message "Decrypting %s...wrote %s" (file-name-nondirectory file)
+            (file-name-nondirectory plain))
     (if (epg-context-result-for context 'verify)
        (epa-display-info (epg-verify-result-to-string
                           (epg-context-result-for context 'verify))))))
@@ -612,10 +615,26 @@ If SECRET is non-nil, list secret keys instead of public keys."
         (epa-select-keys (epg-make-context) "Select keys for signing.
 If no one is selected, default secret key is used.  "
                          nil t)
-        (if (y-or-n-p "Make a detached signature? ")
-            'detached
-          (if (y-or-n-p "Make a cleartext signature? ")
-              'clear))))
+        (catch 'done
+          (while t
+            (message "Signature type (n,c,d,?) ")
+            (let ((c (read-char)))
+              (cond ((eq c ?c)
+                     (throw 'done 'clear))
+                    ((eq c ?d)
+                     (throw 'done 'detached))
+                    ((eq c ??)
+                     (with-output-to-temp-buffer "*Help*"
+                       (save-excursion
+                         (set-buffer standard-output)
+                         (insert "\
+n - Create a normal signature
+c - Create a cleartext signature
+d - Create a detached signature
+? - Show this help
+"))))
+                    (t
+                     (throw 'done nil))))))))
   (let ((signature (concat file
                           (if (or epa-armor
                                   (not (memq mode '(nil t normal detached))))
@@ -633,7 +652,8 @@ If no one is selected, default secret key is used.  "
                                       #'epa-progress-callback-function)
     (message "Signing %s..." (file-name-nondirectory file))
     (epg-sign-file context file signature mode)
-    (message "Signing %s...done" (file-name-nondirectory file))))
+    (message "Signing %s...wrote %s" (file-name-nondirectory file)
+            (file-name-nondirectory signature))))
 
 ;;;###autoload
 (defun epa-encrypt-file (file recipients)
@@ -652,7 +672,8 @@ If no one is selected, symmetric encryption will be performed.  ")))
                                       #'epa-progress-callback-function)
     (message "Encrypting %s..." (file-name-nondirectory file))
     (epg-encrypt-file context file recipients cipher)
-    (message "Encrypting %s...done" (file-name-nondirectory file))))
+    (message "Encrypting %s...wrote %s" (file-name-nondirectory file)
+            (file-name-nondirectory cipher))))
 
 ;;;###autoload
 (defun epa-decrypt-region (start end)
@@ -759,11 +780,9 @@ If no one is selected, default secret key is used.  "
                          nil t)
         (catch 'done
           (while t
-            (message "Signature type (N,c,d,?) ")
+            (message "Signature type (n,c,d,?) ")
             (let ((c (read-char)))
-              (cond ((or (eq c ?n) (eq c ?\n))
-                     (throw 'done nil))
-                    ((eq c ?c)
+              (cond ((eq c ?c)
                      (throw 'done 'clear))
                     ((eq c ?d)
                      (throw 'done 'detached))
@@ -776,7 +795,9 @@ n - Create a normal signature
 c - Create a cleartext signature
 d - Create a detached signature
 ? - Show this help
-"))))))))))
+"))))
+                    (t
+                     (throw 'done nil))))))))
   (save-excursion
     (let ((context (epg-make-context))
          signature)