* epg-package-info.el.in (epg-bug-report-address): New constant.
[elisp/epg.git] / epa-file.el
index 66ed5b9..4d6df44 100644 (file)
@@ -82,6 +82,9 @@ May either be a string or a list of strings.")
 (defvar epa-file-handler
   (cons epa-file-name-regexp 'epa-file-handler))
 
+(defvar epa-file-auto-mode-alist-entry
+  (list epa-file-name-regexp nil 'epa-file))
+
 (defvar epa-file-passphrase-alist nil)
 
 (eval-and-compile
@@ -152,7 +155,10 @@ 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)))
+  (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)
@@ -288,6 +294,7 @@ If no one is selected, symmetric encryption will be performed.  ")))
     (setq file-name-handler-alist
          (cons epa-file-handler file-name-handler-alist))
     (add-hook 'find-file-hooks 'epa-file-find-file-hook)
+    (setq auto-mode-alist (cons epa-file-auto-mode-alist-entry auto-mode-alist))
     (message "`epa-file' enabled")))
 
 ;;;###autoload
@@ -298,6 +305,8 @@ If no one is selected, symmetric encryption will be performed.  ")))
        (setq file-name-handler-alist
              (delq epa-file-handler file-name-handler-alist))
        (remove-hook 'find-file-hooks 'epa-file-find-file-hook)
+       (setq auto-mode-alist (delq epa-file-auto-mode-alist-entry
+                                   auto-mode-alist))
        (message "`epa-file' disabled"))
     (message "`epa-file' already disabled")))