OSDN Git Service

* epa-file.el (epa-file-insert-file-contents): If a file is not
authorDaiki Ueno <ueno@unixuser.org>
Tue, 17 Jul 2007 02:02:06 +0000 (02:02 +0000)
committerDaiki Ueno <ueno@unixuser.org>
Tue, 17 Jul 2007 02:02:06 +0000 (02:02 +0000)
directly accessible, use the local copy of the file.
Reported by Jaroslav Gresula <jgresula@gmail.com>

ChangeLog
epa-file.el

index 11688a5..fb25d2e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-07-17  Daiki Ueno  <ueno@unixuser.org>
+
+       * epa-file.el (epa-file-insert-file-contents): If a file is not
+       directly accessible, use the local copy of the file.
+       Reported by Jaroslav Gresula <jgresula@gmail.com>
+
 2007-07-10  Daiki Ueno  <ueno@unixuser.org>
 
        * epa.el: Removed -face suffix from face names;
index 7eae34e..66ed5b9 100644 (file)
@@ -152,15 +152,16 @@ May either be a string or a list of strings.")
   (if (and visit (or beg end))
       (error "Attempt to visit less than an entire file"))
   (setq file (expand-file-name file))
-  (let ((local-copy (epa-file-run-real-handler #'file-local-copy (list file)))
-       (context (epg-make-context))
-       string length entry)
+  (let* ((local-copy (epa-file-run-real-handler #'file-local-copy (list file)))
+        (local-file (or local-copy file))
+        (context (epg-make-context))
+        string length entry)
     (if visit
        (setq buffer-file-name file))
     (epg-context-set-passphrase-callback
      context
      (cons #'epa-file-passphrase-callback-function
-          file))
+          local-file))
     (epg-context-set-progress-callback context
                                       #'epa-progress-callback-function)
     (unwind-protect
@@ -168,7 +169,7 @@ May either be a string or a list of strings.")
          (if replace
              (goto-char (point-min)))
          (condition-case error
-             (setq string (epg-decrypt-file context file nil))
+             (setq string (epg-decrypt-file context local-file nil))
            (error
             (if (setq entry (assoc file epa-file-passphrase-alist))
                 (setcdr entry nil))