Mercurial > emacs
comparison lisp/epa-file.el @ 109534:52f611292230
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).
author | Daiki Ueno <ueno@unixuser.org> |
---|---|
date | Sun, 25 Jul 2010 20:23:43 +0900 |
parents | b70c159d9e1e |
children | 1eca4fd49be3 |
comparison
equal
deleted
inserted
replaced
109533:bbcf76ef0f72 | 109534:52f611292230 |
---|---|
137 (condition-case error | 137 (condition-case error |
138 (setq string (epg-decrypt-file context local-file nil)) | 138 (setq string (epg-decrypt-file context local-file nil)) |
139 (error | 139 (error |
140 (if (setq entry (assoc file epa-file-passphrase-alist)) | 140 (if (setq entry (assoc file epa-file-passphrase-alist)) |
141 (setcdr entry nil)) | 141 (setcdr entry nil)) |
142 ;; Hack to prevent find-file from opening empty buffer | 142 (when (file-exists-p local-file) |
143 ;; when decryption failed (bug#6568). See the place | 143 ;; Hack to prevent find-file from opening empty buffer |
144 ;; where `find-file-not-found-functions' are called in | 144 ;; when decryption failed (bug#6568). See the place |
145 ;; `find-file-noselect-1'. | 145 ;; where `find-file-not-found-functions' are called in |
146 (make-local-variable 'epa-file-error) | 146 ;; `find-file-noselect-1'. |
147 (setq epa-file-error error) | 147 (make-local-variable 'epa-file-error) |
148 (add-hook 'find-file-not-found-functions | 148 (setq epa-file-error error) |
149 'epa-file--find-file-not-found-function | 149 (add-hook 'find-file-not-found-functions |
150 nil t) | 150 'epa-file--find-file-not-found-function |
151 nil t)) | |
151 (signal 'file-error | 152 (signal 'file-error |
152 (cons "Opening input file" (cdr error))))) | 153 (cons "Opening input file" (cdr error))))) |
153 (make-local-variable 'epa-file-encrypt-to) | 154 (make-local-variable 'epa-file-encrypt-to) |
154 (setq epa-file-encrypt-to | 155 (setq epa-file-encrypt-to |
155 (mapcar #'car (epg-context-result-for context 'encrypted-to))) | 156 (mapcar #'car (epg-context-result-for context 'encrypted-to))) |