Commit b12bb4dc authored by Daiki Ueno's avatar Daiki Ueno
Browse files

epg: Don't show "*Error*" buffer when visiting a new file

* epa-file.el (epa-file-insert-file-contents): Don't show
"*Error*" buffer if input file does not exist.
Reported by Herbert J. Skuhra.
parent 0b37f903
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> 2014-11-18 Paul Pogonyshev <pogonyshev@gmail.com>
Rüdiger Sonderfeld <ruediger@c-plusplus.net> Rüdiger Sonderfeld <ruediger@c-plusplus.net>
   
......
...@@ -153,7 +153,6 @@ encryption is used." ...@@ -153,7 +153,6 @@ encryption is used."
(condition-case error (condition-case error
(setq string (epg-decrypt-file context local-file nil)) (setq string (epg-decrypt-file context local-file nil))
(error (error
(epa-display-error context)
(if (setq entry (assoc file epa-file-passphrase-alist)) (if (setq entry (assoc file epa-file-passphrase-alist))
(setcdr entry nil)) (setcdr entry nil))
;; If the decryption program can't be found, ;; If the decryption program can't be found,
...@@ -164,15 +163,16 @@ encryption is used." ...@@ -164,15 +163,16 @@ encryption is used."
(equal (cadr error) "Searching for program")) (equal (cadr error) "Searching for program"))
(error "Decryption program `%s' not found" (error "Decryption program `%s' not found"
(nth 3 error))) (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) (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) (setq-local epa-file-error error)
(add-hook 'find-file-not-found-functions (add-hook 'find-file-not-found-functions
'epa-file--find-file-not-found-function 'epa-file--find-file-not-found-function
nil t)) nil t)
(epa-display-error context))
(signal 'file-error (signal 'file-error
(cons "Opening input file" (cdr error))))) (cons "Opening input file" (cdr error)))))
(set-buffer buf) ;In case timer/filter changed/killed it (bug#16029)! (set-buffer buf) ;In case timer/filter changed/killed it (bug#16029)!
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment