diff options
| author | Luc Teirlinck | 2004-05-29 01:54:11 +0000 |
|---|---|---|
| committer | Luc Teirlinck | 2004-05-29 01:54:11 +0000 |
| commit | 0a11c70bb208aa1721c51befbb6e427cc8750e04 (patch) | |
| tree | e465956e0fc59ab7ce6b8aa27375eee4303e2555 | |
| parent | 227ef0ff6c5682188c80d763d89c27d1f4ec3cfd (diff) | |
| download | emacs-0a11c70bb208aa1721c51befbb6e427cc8750e04.tar.gz emacs-0a11c70bb208aa1721c51befbb6e427cc8750e04.zip | |
(find-file-noselect-1): Do not bind `inhibit-read-only' to t during
execution of `find-file-not-found-functions'.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/files.el | 42 |
2 files changed, 28 insertions, 20 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f748728d7fc..25093d8d764 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2004-05-28 Luc Teirlinck <teirllm@auburn.edu> | ||
| 2 | |||
| 3 | * files.el (find-file-noselect-1): Do not bind | ||
| 4 | `inhibit-read-only' to t during execution of | ||
| 5 | `find-file-not-found-functions'. | ||
| 6 | |||
| 1 | 2004-05-28 Stefan Monnier <monnier@iro.umontreal.ca> | 7 | 2004-05-28 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 8 | ||
| 3 | * vc-mcvs.el (vc-mcvs-print-log, vc-mcvs-diff): | 9 | * 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." | |||
| 1365 | (kill-local-variable 'buffer-file-coding-system) | 1365 | (kill-local-variable 'buffer-file-coding-system) |
| 1366 | (kill-local-variable 'cursor-type) | 1366 | (kill-local-variable 'cursor-type) |
| 1367 | (let ((inhibit-read-only t)) | 1367 | (let ((inhibit-read-only t)) |
| 1368 | (erase-buffer) | 1368 | (erase-buffer)) |
| 1369 | (and (default-value 'enable-multibyte-characters) | 1369 | (and (default-value 'enable-multibyte-characters) |
| 1370 | (not rawfile) | 1370 | (not rawfile) |
| 1371 | (set-buffer-multibyte t)) | 1371 | (set-buffer-multibyte t)) |
| 1372 | (if rawfile | 1372 | (if rawfile |
| 1373 | (condition-case () | ||
| 1374 | (insert-file-contents-literally filename t) | ||
| 1375 | (file-error | ||
| 1376 | (when (and (file-exists-p filename) | ||
| 1377 | (not (file-readable-p filename))) | ||
| 1378 | (kill-buffer buf) | ||
| 1379 | (signal 'file-error (list "File is not readable" | ||
| 1380 | filename))) | ||
| 1381 | ;; Unconditionally set error | ||
| 1382 | (setq error t))) | ||
| 1383 | (condition-case () | 1373 | (condition-case () |
| 1384 | (insert-file-contents filename t) | 1374 | (let ((inhibit-read-only t)) |
| 1375 | (insert-file-contents-literally filename t)) | ||
| 1385 | (file-error | 1376 | (file-error |
| 1386 | (when (and (file-exists-p filename) | 1377 | (when (and (file-exists-p filename) |
| 1387 | (not (file-readable-p filename))) | 1378 | (not (file-readable-p filename))) |
| 1388 | (kill-buffer buf) | 1379 | (kill-buffer buf) |
| 1389 | (signal 'file-error (list "File is not readable" | 1380 | (signal 'file-error (list "File is not readable" |
| 1390 | filename))) | 1381 | filename))) |
| 1391 | ;; Run find-file-not-found-hooks until one returns non-nil. | 1382 | ;; Unconditionally set error |
| 1392 | (or (run-hook-with-args-until-success 'find-file-not-found-functions) | 1383 | (setq error t))) |
| 1393 | ;; If they fail too, set error. | 1384 | (condition-case () |
| 1394 | (setq error t)))))) | 1385 | (let ((inhibit-read-only t)) |
| 1386 | (insert-file-contents filename t)) | ||
| 1387 | (file-error | ||
| 1388 | (when (and (file-exists-p filename) | ||
| 1389 | (not (file-readable-p filename))) | ||
| 1390 | (kill-buffer buf) | ||
| 1391 | (signal 'file-error (list "File is not readable" | ||
| 1392 | filename))) | ||
| 1393 | ;; Run find-file-not-found-hooks until one returns non-nil. | ||
| 1394 | (or (run-hook-with-args-until-success 'find-file-not-found-functions) | ||
| 1395 | ;; If they fail too, set error. | ||
| 1396 | (setq error t))))) | ||
| 1395 | ;; Record the file's truename, and maybe use that as visited name. | 1397 | ;; Record the file's truename, and maybe use that as visited name. |
| 1396 | (if (equal filename buffer-file-name) | 1398 | (if (equal filename buffer-file-name) |
| 1397 | (setq buffer-file-truename truename) | 1399 | (setq buffer-file-truename truename) |