# HG changeset patch # User Luc Teirlinck # Date 1085795519 0 # Node ID ef8edc11a6e40fad3370cf34d34bd19c74f4e5c2 # Parent 51a4742fb73b01f127320e512b7db3071c8213ba (find-file-noselect-1): Do not bind `inhibit-read-only' to t during execution of `find-file-not-found-functions'. diff -r 51a4742fb73b -r ef8edc11a6e4 lisp/files.el --- 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)