]> git.eshelyaron.com Git - emacs.git/commitdiff
* epa.el (epa-decrypt-file): Take output file name as argument
authorRichard M. Stallman <rms@gnu.org>
Sat, 11 May 2013 13:14:07 +0000 (09:14 -0400)
committerRichard M. Stallman <rms@gnu.org>
Sat, 11 May 2013 13:14:07 +0000 (09:14 -0400)
and read it using `interactive'.

lisp/ChangeLog
lisp/epa.el

index 378df9359cb89afb724aed74f51b6ef846e42cac..6fdcb1e143b9e0b769e115acd1fe288217057869 100644 (file)
@@ -1,3 +1,8 @@
+2013-05-11  Richard Stallman  <rms@gnu.org>
+
+       * epa.el (epa-decrypt-file): Take output file name as argument
+       and read it using `interactive'.
+
 2013-05-11  Leo Liu  <sdl.web@gmail.com>
 
        * progmodes/octave.el (octave-beginning-of-line)
index 852d10b1cf7f6ba40863f2dba61572911439edac..b567df5f40b65e7c605864aa94fa5984b8a9bf10 100644 (file)
@@ -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))))))