summaryrefslogtreecommitdiff
path: root/lisp/epa.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2013-05-11 09:14:07 -0400
committerRichard M. Stallman <rms@gnu.org>2013-05-11 09:14:07 -0400
commit212e29f2e2b0df4ddc89de1208bef46625ae8ad4 (patch)
tree1276940a647a8faf732600ce838ab110f6657ad8 /lisp/epa.el
parent6980b0cabf5c73581fc6a5a05f62457042050794 (diff)
downloademacs-212e29f2e2b0df4ddc89de1208bef46625ae8ad4.tar.gz
* epa.el (epa-decrypt-file): Take output file name as argument
and read it using `interactive'.
Diffstat (limited to 'lisp/epa.el')
-rw-r--r--lisp/epa.el39
1 files changed, 21 insertions, 18 deletions
diff --git a/lisp/epa.el b/lisp/epa.el
index 852d10b1cf7..b567df5f40b 100644
--- a/lisp/epa.el
+++ b/lisp/epa.el
@@ -621,30 +621,33 @@ If SECRET is non-nil, list secret keys instead of public keys."
(message "%s..." prompt))))
;;;###autoload
-(defun epa-decrypt-file (file)
- "Decrypt FILE."
- (interactive "fFile: ")
- (setq file (expand-file-name file))
- (let* ((default-name (file-name-sans-extension file))
- (plain (expand-file-name
- (read-file-name
- (concat "To file (default "
- (file-name-nondirectory default-name)
- ") ")
- (file-name-directory default-name)
- default-name)))
- (context (epg-make-context epa-protocol)))
+(defun epa-decrypt-file (decrypt-file plain-file)
+ "Decrypt DECRYPT-FILE into PLAIN-FILE."
+ (interactive
+ (let (file default-name plain)
+ (setq file (read-file-name "File to decrypt: "))
+ (setq default-name (file-name-sans-extension (expand-file-name file)))
+ (setq plain (expand-file-name
+ (read-file-name
+ (concat "To file (default "
+ (file-name-nondirectory default-name)
+ ") ")
+ (file-name-directory default-name)
+ default-name)))
+ (list file plain)))
+ (setq decrypt-file (expand-file-name decrypt-file))
+ (let ((context (epg-make-context epa-protocol)))
(epg-context-set-passphrase-callback context
#'epa-passphrase-callback-function)
(epg-context-set-progress-callback context
(cons
#'epa-progress-callback-function
(format "Decrypting %s..."
- (file-name-nondirectory file))))
- (message "Decrypting %s..." (file-name-nondirectory file))
- (epg-decrypt-file context file plain)
- (message "Decrypting %s...wrote %s" (file-name-nondirectory file)
- (file-name-nondirectory plain))
+ (file-name-nondirectory decrypt-file))))
+ (message "Decrypting %s..." (file-name-nondirectory decrypt-file))
+ (epg-decrypt-file context decrypt-file plain-file)
+ (message "Decrypting %s...wrote %s" (file-name-nondirectory decrypt-file)
+ (file-name-nondirectory plain-file))
(if (epg-context-result-for context 'verify)
(epa-display-info (epg-verify-result-to-string
(epg-context-result-for context 'verify))))))