diff options
| author | Daiki Ueno | 2014-11-18 12:46:15 +0900 |
|---|---|---|
| committer | Daiki Ueno | 2014-11-18 12:48:14 +0900 |
| commit | b12bb4dc3ecc74c99031538fc8d3565d276a18d7 (patch) | |
| tree | beaf0fd161d0be5d6fd0cf1343643f1a4556d1e2 | |
| parent | 0b37f903b62b29726644dbad330d2a0bf91d85d6 (diff) | |
| download | emacs-b12bb4dc3ecc74c99031538fc8d3565d276a18d7.tar.gz emacs-b12bb4dc3ecc74c99031538fc8d3565d276a18d7.zip | |
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.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/epa-file.el | 12 |
2 files changed, 12 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 968ea8df0ef..462d0047087 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2014-11-18 Daiki Ueno <ueno@gnu.org> | ||
| 2 | |||
| 3 | * epa-file.el (epa-file-insert-file-contents): Don't show | ||
| 4 | "*Error*" buffer if input file does not exist. | ||
| 5 | Reported by Herbert J. Skuhra. | ||
| 6 | |||
| 1 | 2014-11-18 Paul Pogonyshev <pogonyshev@gmail.com> | 7 | 2014-11-18 Paul Pogonyshev <pogonyshev@gmail.com> |
| 2 | RĂ¼diger Sonderfeld <ruediger@c-plusplus.net> | 8 | RĂ¼diger Sonderfeld <ruediger@c-plusplus.net> |
| 3 | 9 | ||
diff --git a/lisp/epa-file.el b/lisp/epa-file.el index e70bf6d13df..cdaa8ba5f3d 100644 --- a/lisp/epa-file.el +++ b/lisp/epa-file.el | |||
| @@ -153,7 +153,6 @@ encryption is used." | |||
| 153 | (condition-case error | 153 | (condition-case error |
| 154 | (setq string (epg-decrypt-file context local-file nil)) | 154 | (setq string (epg-decrypt-file context local-file nil)) |
| 155 | (error | 155 | (error |
| 156 | (epa-display-error context) | ||
| 157 | (if (setq entry (assoc file epa-file-passphrase-alist)) | 156 | (if (setq entry (assoc file epa-file-passphrase-alist)) |
| 158 | (setcdr entry nil)) | 157 | (setcdr entry nil)) |
| 159 | ;; If the decryption program can't be found, | 158 | ;; If the decryption program can't be found, |
| @@ -164,15 +163,16 @@ encryption is used." | |||
| 164 | (equal (cadr error) "Searching for program")) | 163 | (equal (cadr error) "Searching for program")) |
| 165 | (error "Decryption program `%s' not found" | 164 | (error "Decryption program `%s' not found" |
| 166 | (nth 3 error))) | 165 | (nth 3 error))) |
| 167 | ;; Hack to prevent find-file from opening empty buffer | ||
| 168 | ;; when decryption failed (bug#6568). See the place | ||
| 169 | ;; where `find-file-not-found-functions' are called in | ||
| 170 | ;; `find-file-noselect-1'. | ||
| 171 | (when (file-exists-p local-file) | 166 | (when (file-exists-p local-file) |
| 167 | ;; Hack to prevent find-file from opening empty buffer | ||
| 168 | ;; when decryption failed (bug#6568). See the place | ||
| 169 | ;; where `find-file-not-found-functions' are called in | ||
| 170 | ;; `find-file-noselect-1'. | ||
| 172 | (setq-local epa-file-error error) | 171 | (setq-local epa-file-error error) |
| 173 | (add-hook 'find-file-not-found-functions | 172 | (add-hook 'find-file-not-found-functions |
| 174 | 'epa-file--find-file-not-found-function | 173 | 'epa-file--find-file-not-found-function |
| 175 | nil t)) | 174 | nil t) |
| 175 | (epa-display-error context)) | ||
| 176 | (signal 'file-error | 176 | (signal 'file-error |
| 177 | (cons "Opening input file" (cdr error))))) | 177 | (cons "Opening input file" (cdr error))))) |
| 178 | (set-buffer buf) ;In case timer/filter changed/killed it (bug#16029)! | 178 | (set-buffer buf) ;In case timer/filter changed/killed it (bug#16029)! |