(epa-verify-region): Decode the plaintext by
[elisp/epg.git] / epa-file.el
index 470f6f4..a6a800e 100644 (file)
@@ -34,7 +34,7 @@
   (if (fboundp 'epa-file-name-regexp-update)
       (epa-file-name-regexp-update)))
 
-(defcustom epa-file-name-regexp "\\.gpg\\(~\\|\\.~[.0-9]+~\\)?\\'"
+(defcustom epa-file-name-regexp "\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'"
   "Regexp which matches filenames to be encrypted with GnuPG.
 
 If you set this outside Custom while epa-file is already enabled, you
@@ -152,15 +152,19 @@ 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
+         (condition-case inl
+             (epa-file-run-real-handler #'file-local-copy (list file))
+           (error)))
+        (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 +172,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))