Mercurial > emacs
changeset 55818:ef8edc11a6e4
(find-file-noselect-1): Do not bind `inhibit-read-only' to t during
execution of `find-file-not-found-functions'.
author | Luc Teirlinck <teirllm@auburn.edu> |
---|---|
date | Sat, 29 May 2004 01:51:59 +0000 |
parents | 51a4742fb73b |
children | 308ecbad518a |
files | lisp/files.el |
diffstat | 1 files changed, 22 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/files.el Sat May 29 00:01:42 2004 +0000 +++ b/lisp/files.el Sat May 29 01:51:59 2004 +0000 @@ -1365,33 +1365,35 @@ (kill-local-variable 'buffer-file-coding-system) (kill-local-variable 'cursor-type) (let ((inhibit-read-only t)) - (erase-buffer) - (and (default-value 'enable-multibyte-characters) - (not rawfile) - (set-buffer-multibyte t)) - (if rawfile - (condition-case () - (insert-file-contents-literally filename t) - (file-error - (when (and (file-exists-p filename) - (not (file-readable-p filename))) - (kill-buffer buf) - (signal 'file-error (list "File is not readable" - filename))) - ;; Unconditionally set error - (setq error t))) + (erase-buffer)) + (and (default-value 'enable-multibyte-characters) + (not rawfile) + (set-buffer-multibyte t)) + (if rawfile (condition-case () - (insert-file-contents filename t) + (let ((inhibit-read-only t)) + (insert-file-contents-literally filename t)) (file-error (when (and (file-exists-p filename) (not (file-readable-p filename))) (kill-buffer buf) (signal 'file-error (list "File is not readable" filename))) - ;; Run find-file-not-found-hooks until one returns non-nil. - (or (run-hook-with-args-until-success 'find-file-not-found-functions) - ;; If they fail too, set error. - (setq error t)))))) + ;; Unconditionally set error + (setq error t))) + (condition-case () + (let ((inhibit-read-only t)) + (insert-file-contents filename t)) + (file-error + (when (and (file-exists-p filename) + (not (file-readable-p filename))) + (kill-buffer buf) + (signal 'file-error (list "File is not readable" + filename))) + ;; Run find-file-not-found-hooks until one returns non-nil. + (or (run-hook-with-args-until-success 'find-file-not-found-functions) + ;; If they fail too, set error. + (setq error t))))) ;; Record the file's truename, and maybe use that as visited name. (if (equal filename buffer-file-name) (setq buffer-file-truename truename)