diff options
| author | Gerd Moellmann | 2001-10-05 12:10:57 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-10-05 12:10:57 +0000 |
| commit | a8d002d2a6127f6aee05eaa62293dd75c28ee31e (patch) | |
| tree | 584ca2a8b1b9207df78ce5a69fcb5932118de615 | |
| parent | f2e7e23e006d70f2887e38b6e867264e847941b2 (diff) | |
| download | emacs-a8d002d2a6127f6aee05eaa62293dd75c28ee31e.tar.gz emacs-a8d002d2a6127f6aee05eaa62293dd75c28ee31e.zip | |
(find-file-noselect): If file's read-only status has
changed on disk, ask if buffer's read-only status should be
changed, unless NOWARN is set.
| -rw-r--r-- | lisp/files.el | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lisp/files.el b/lisp/files.el index bdd5604417d..84c167f756b 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -1069,6 +1069,19 @@ that are visiting the various files." | |||
| 1069 | (with-current-buffer buf | 1069 | (with-current-buffer buf |
| 1070 | (revert-buffer t t))))) | 1070 | (revert-buffer t t))))) |
| 1071 | (with-current-buffer buf | 1071 | (with-current-buffer buf |
| 1072 | |||
| 1073 | ;; Check if a formerly read-only file has become | ||
| 1074 | ;; writable and vice versa. | ||
| 1075 | (let ((read-only (not (file-writable-p buffer-file-name)))) | ||
| 1076 | (unless (eq read-only buffer-read-only) | ||
| 1077 | (when (or nowarn | ||
| 1078 | (let ((question | ||
| 1079 | (format "File %s is %s on disk. Change buffer mode? " | ||
| 1080 | buffer-file-name | ||
| 1081 | (if read-only "read-only" "writable")))) | ||
| 1082 | (y-or-n-p question))) | ||
| 1083 | (setq buffer-read-only read-only)))) | ||
| 1084 | |||
| 1072 | (when (not (eq (not (null rawfile)) | 1085 | (when (not (eq (not (null rawfile)) |
| 1073 | (not (null find-file-literally)))) | 1086 | (not (null find-file-literally)))) |
| 1074 | (if (buffer-modified-p) | 1087 | (if (buffer-modified-p) |