]> code.delx.au - gnu-emacs/commitdiff
epg: Don't show "*Error*" buffer when visiting a new file
authorDaiki Ueno <ueno@unixuser.org>
Tue, 18 Nov 2014 03:46:15 +0000 (12:46 +0900)
committerDaiki Ueno <ueno@unixuser.org>
Tue, 18 Nov 2014 03:48:14 +0000 (12:48 +0900)
* epa-file.el (epa-file-insert-file-contents): Don't show
"*Error*" buffer if input file does not exist.
Reported by Herbert J. Skuhra.

lisp/ChangeLog
lisp/epa-file.el

index 968ea8df0effcd3cecfa63f638c5ab1f21c3a8f6..462d0047087c0cc931fce174691a78424deea85f 100644 (file)
@@ -1,3 +1,9 @@
+2014-11-18  Daiki Ueno  <ueno@gnu.org>
+
+       * epa-file.el (epa-file-insert-file-contents): Don't show
+       "*Error*" buffer if input file does not exist.
+       Reported by Herbert J. Skuhra.
+
 2014-11-18  Paul Pogonyshev  <pogonyshev@gmail.com>
            RĂ¼diger Sonderfeld  <ruediger@c-plusplus.net>
 
index e70bf6d13df22b7f5afc80b89b0a41f5e792f221..cdaa8ba5f3d457a1feba0e901403a5f3e58f41aa 100644 (file)
@@ -153,7 +153,6 @@ encryption is used."
          (condition-case error
              (setq string (epg-decrypt-file context local-file nil))
            (error
-            (epa-display-error context)
             (if (setq entry (assoc file epa-file-passphrase-alist))
                 (setcdr entry nil))
             ;; If the decryption program can't be found,
@@ -164,15 +163,16 @@ encryption is used."
                      (equal (cadr error) "Searching for program"))
                 (error "Decryption program `%s' not found"
                        (nth 3 error)))
-            ;; Hack to prevent find-file from opening empty buffer
-            ;; when decryption failed (bug#6568).  See the place
-            ;; where `find-file-not-found-functions' are called in
-            ;; `find-file-noselect-1'.
             (when (file-exists-p local-file)
+              ;; Hack to prevent find-file from opening empty buffer
+              ;; when decryption failed (bug#6568).  See the place
+              ;; where `find-file-not-found-functions' are called in
+              ;; `find-file-noselect-1'.
               (setq-local epa-file-error error)
               (add-hook 'find-file-not-found-functions
                         'epa-file--find-file-not-found-function
-                        nil t))
+                        nil t)
+              (epa-display-error context))
             (signal 'file-error
                     (cons "Opening input file" (cdr error)))))
           (set-buffer buf) ;In case timer/filter changed/killed it (bug#16029)!