From: Luc Teirlinck Date: Sat, 29 May 2004 01:54:11 +0000 (+0000) Subject: (find-file-noselect-1): Do not bind `inhibit-read-only' to t during X-Git-Tag: ttn-vms-21-2-B4~6022 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0a11c70bb208aa1721c51befbb6e427cc8750e04;p=emacs.git (find-file-noselect-1): Do not bind `inhibit-read-only' to t during execution of `find-file-not-found-functions'. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f748728d7fc..25093d8d764 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2004-05-28 Luc Teirlinck + + * 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 * vc-mcvs.el (vc-mcvs-print-log, vc-mcvs-diff): diff --git a/lisp/files.el b/lisp/files.el index 13145faeddb..27e0ded28e2 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -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)