aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuc Teirlinck2004-05-20 23:32:27 +0000
committerLuc Teirlinck2004-05-20 23:32:27 +0000
commit4edcfd1772d0f58c6000a41b9ae3ab7796266e47 (patch)
tree3a04932e212512c5af10ff879a51f43a60428cc8
parent931285e29dea839234cb8276fea6c621c8163a96 (diff)
downloademacs-4edcfd1772d0f58c6000a41b9ae3ab7796266e47.tar.gz
emacs-4edcfd1772d0f58c6000a41b9ae3ab7796266e47.zip
(find-file-noselect-1): Limit the scope of the
`inhibit-read-only' binding. Make sure that `inhibit-read-only' is, by default, nil during the execution of `find-file-not-found-functions' and `find-file-hook'.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/files.el57
2 files changed, 36 insertions, 28 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a6271544405..00e75ded5ec 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12004-05-20 Luc Teirlinck <teirllm@auburn.edu>
2
3 * files.el (find-file-noselect-1): Limit the scope of the
4 `inhibit-read-only' binding. Make sure that `inhibit-read-only'
5 is, by default, nil during the execution of
6 `find-file-not-found-functions' and `find-file-hook'.
7
12004-05-20 Michael Mauger <mmaug@yahoo.com> 82004-05-20 Michael Mauger <mmaug@yahoo.com>
2 9
3 * facemenu.el (facemenu-color-name-equal): New function. 10 * facemenu.el (facemenu-color-name-equal): New function.
diff --git a/lisp/files.el b/lisp/files.el
index 99cad16cf5b..dd3a45e09e1 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1357,41 +1357,42 @@ that are visiting the various files."
1357 rawfile truename number)))))) 1357 rawfile truename number))))))
1358 1358
1359(defun find-file-noselect-1 (buf filename nowarn rawfile truename number) 1359(defun find-file-noselect-1 (buf filename nowarn rawfile truename number)
1360 (let ((inhibit-read-only t) 1360 (let (error)
1361 error)
1362 (with-current-buffer buf 1361 (with-current-buffer buf
1363 (kill-local-variable 'find-file-literally) 1362 (kill-local-variable 'find-file-literally)
1364 ;; Needed in case we are re-visiting the file with a different 1363 ;; Needed in case we are re-visiting the file with a different
1365 ;; text representation. 1364 ;; text representation.
1366 (kill-local-variable 'buffer-file-coding-system) 1365 (kill-local-variable 'buffer-file-coding-system)
1367 (kill-local-variable 'cursor-type) 1366 (kill-local-variable 'cursor-type)
1368 (erase-buffer) 1367 (let ((inhibit-read-only t))
1369 (and (default-value 'enable-multibyte-characters) 1368 (erase-buffer)
1370 (not rawfile) 1369 (and (default-value 'enable-multibyte-characters)
1371 (set-buffer-multibyte t)) 1370 (not rawfile)
1372 (if rawfile 1371 (set-buffer-multibyte t))
1373 (condition-case () 1372 (if rawfile
1374 (insert-file-contents-literally filename t) 1373 (condition-case ()
1375 (file-error 1374 (insert-file-contents-literally filename t)
1376 (when (and (file-exists-p filename) 1375 (file-error
1377 (not (file-readable-p filename))) 1376 (when (and (file-exists-p filename)
1378 (kill-buffer buf) 1377 (not (file-readable-p filename)))
1379 (signal 'file-error (list "File is not readable" 1378 (kill-buffer buf)
1380 filename))) 1379 (signal 'file-error (list "File is not readable"
1381 ;; Unconditionally set error 1380 filename)))
1382 (setq error t))) 1381 ;; Unconditionally set error
1383 (condition-case ()
1384 (insert-file-contents filename t)
1385 (file-error
1386 (when (and (file-exists-p filename)
1387 (not (file-readable-p filename)))
1388 (kill-buffer buf)
1389 (signal 'file-error (list "File is not readable"
1390 filename)))
1391 ;; Run find-file-not-found-hooks until one returns non-nil.
1392 (or (run-hook-with-args-until-success 'find-file-not-found-functions)
1393 ;; If they fail too, set error.
1394 (setq error t))))) 1382 (setq error t)))))
1383 (condition-case ()
1384 (let ((inhibit-read-only t))
1385 (insert-file-contents filename t))
1386 (file-error
1387 (when (and (file-exists-p filename)
1388 (not (file-readable-p filename)))
1389 (kill-buffer buf)
1390 (signal 'file-error (list "File is not readable"
1391 filename)))
1392 ;; Run find-file-not-found-hooks until one returns non-nil.
1393 (or (run-hook-with-args-until-success 'find-file-not-found-functions)
1394 ;; If they fail too, set error.
1395 (setq error t))))
1395 ;; Record the file's truename, and maybe use that as visited name. 1396 ;; Record the file's truename, and maybe use that as visited name.
1396 (if (equal filename buffer-file-name) 1397 (if (equal filename buffer-file-name)
1397 (setq buffer-file-truename truename) 1398 (setq buffer-file-truename truename)