summaryrefslogtreecommitdiff
path: root/lisp/epa-file.el
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@unixuser.org>2010-07-25 20:23:43 +0900
committerDaiki Ueno <ueno@unixuser.org>2010-07-25 20:23:43 +0900
commit4f195cf7040ce0d934c25ec132313c7bc07f1ca9 (patch)
tree45efc8b803c689b2df49331c44241f634aa394d0 /lisp/epa-file.el
parent86fb10614e2267032e42eb09a20c3c4be179b2de (diff)
downloademacs-4f195cf7040ce0d934c25ec132313c7bc07f1ca9.tar.gz
Fix *.gpg file creation (bug#6723).
* epa-file.el (epa-file-insert-file-contents): Check if LOCAL-FILE exists before passing an error to find-file-not-found-functions (bug#6723).
Diffstat (limited to 'lisp/epa-file.el')
-rw-r--r--lisp/epa-file.el19
1 files changed, 10 insertions, 9 deletions
diff --git a/lisp/epa-file.el b/lisp/epa-file.el
index 5870f23bf13..53dc7ddac76 100644
--- a/lisp/epa-file.el
+++ b/lisp/epa-file.el
@@ -139,15 +139,16 @@ way."
(error
(if (setq entry (assoc file epa-file-passphrase-alist))
(setcdr entry nil))
- ;; 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'.
- (make-local-variable 'epa-file-error)
- (setq epa-file-error error)
- (add-hook 'find-file-not-found-functions
- 'epa-file--find-file-not-found-function
- nil t)
+ (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'.
+ (make-local-variable 'epa-file-error)
+ (setq epa-file-error error)
+ (add-hook 'find-file-not-found-functions
+ 'epa-file--find-file-not-found-function
+ nil t))
(signal 'file-error
(cons "Opening input file" (cdr error)))))
(make-local-variable 'epa-file-encrypt-to)