(find-file-noselect-1): Do not bind `inhibit-read-only' to t during

execution of `find-file-not-found-functions'.
This commit is contained in:
Luc Teirlinck 2004-05-29 01:54:11 +00:00
parent 227ef0ff6c
commit 0a11c70bb2
2 changed files with 28 additions and 20 deletions

View file

@ -1,3 +1,9 @@
2004-05-28 Luc Teirlinck <teirllm@auburn.edu>
* files.el (find-file-noselect-1): Do not bind
`inhibit-read-only' to t during execution of
`find-file-not-found-functions'.
2004-05-28 Stefan Monnier <monnier@iro.umontreal.ca>
* vc-mcvs.el (vc-mcvs-print-log, vc-mcvs-diff):

View file

@ -1365,33 +1365,35 @@ that are visiting the various files."
(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)