From: Richard M. Stallman Date: Sat, 11 May 2013 13:14:07 +0000 (-0400) Subject: * epa.el (epa-decrypt-file): Take output file name as argument X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~2026^2~229^2~116 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=212e29f2e2b0df4ddc89de1208bef46625ae8ad4;p=emacs.git * epa.el (epa-decrypt-file): Take output file name as argument and read it using `interactive'. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 378df9359cb..6fdcb1e143b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-05-11 Richard Stallman + + * epa.el (epa-decrypt-file): Take output file name as argument + and read it using `interactive'. + 2013-05-11 Leo Liu * progmodes/octave.el (octave-beginning-of-line) 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))))))