diff options
author | Gerd Moellmann <gerd@gnu.org> | 2001-10-05 12:10:57 +0000 |
---|---|---|
committer | Gerd Moellmann <gerd@gnu.org> | 2001-10-05 12:10:57 +0000 |
commit | a8d002d2a6127f6aee05eaa62293dd75c28ee31e (patch) | |
tree | 584ca2a8b1b9207df78ce5a69fcb5932118de615 /lisp/files.el | |
parent | f2e7e23e006d70f2887e38b6e867264e847941b2 (diff) | |
download | emacs-a8d002d2a6127f6aee05eaa62293dd75c28ee31e.tar.gz |
(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.
Diffstat (limited to 'lisp/files.el')
-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." (with-current-buffer buf (revert-buffer t t))))) (with-current-buffer buf + + ;; Check if a formerly read-only file has become + ;; writable and vice versa. + (let ((read-only (not (file-writable-p buffer-file-name)))) + (unless (eq read-only buffer-read-only) + (when (or nowarn + (let ((question + (format "File %s is %s on disk. Change buffer mode? " + buffer-file-name + (if read-only "read-only" "writable")))) + (y-or-n-p question))) + (setq buffer-read-only read-only)))) + (when (not (eq (not (null rawfile)) (not (null find-file-literally)))) (if (buffer-modified-p) |