diff options
author | Richard M. Stallman <rms@gnu.org> | 1999-09-17 20:57:37 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1999-09-17 20:57:37 +0000 |
commit | 8120f989022ed9ba82eefa6723e484db9a1e1ccb (patch) | |
tree | 62207f6e844b29f731dfc5fa2ec29d0e8ebe88ac /lisp | |
parent | 07eeca5d43e7361849dd104e6615837c81ad7bce (diff) | |
download | emacs-8120f989022ed9ba82eefa6723e484db9a1e1ccb.tar.gz |
(after-find-file): When visiting a backup file, make it read-only.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/files.el | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/files.el b/lisp/files.el index ee56e4d3bf2..144d79da28e 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1189,7 +1189,7 @@ unless NOMODES is non-nil." (msg (cond ((and error (file-attributes buffer-file-name)) (setq buffer-read-only t) - "File exists, but cannot be read.") + "File exists, but cannot be read") ((not buffer-read-only) (if (and warn (file-newer-than-file-p (make-auto-save-file-name) @@ -1216,6 +1216,10 @@ unless NOMODES is non-nil." (or not-serious (sit-for 1 nil t))))) (if (and auto-save-default (not noauto)) (auto-save-mode t))) + ;; Make people do a little extra work (C-x C-q) + ;; before altering a backup file. + (if (backup-file-name-p buffer-file-name) + (setq buffer-read-only t)) (if nomodes nil (and view-read-only view-mode |