diff options
author | Tassilo Horn <tsdh@gnu.org> | 2019-09-22 11:02:39 +0200 |
---|---|---|
committer | Tassilo Horn <tsdh@gnu.org> | 2019-09-22 11:02:39 +0200 |
commit | af0642a4cb220f33a43d1380be085bc0b7134bb8 (patch) | |
tree | e3b1b57bc42e712c77bd55fc4fc722cf93fe6c66 /lisp/files.el | |
parent | 8992bc7d1b7e7babbf2899b5c45e84b486f504e6 (diff) | |
parent | 37a4233a366797360c2f4f475591a3406586bcfb (diff) | |
download | emacs-scratch/tsdh-vc-list-files.tar.gz |
Merge remote-tracking branch 'origin/master' into scratch/tsdh-vc-list-filesscratch/tsdh-vc-list-files
Diffstat (limited to 'lisp/files.el')
-rw-r--r-- | lisp/files.el | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lisp/files.el b/lisp/files.el index ce4dd99bd53..5ceaacd744e 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2554,13 +2554,13 @@ unless NOMODES is non-nil." (auto-save-mode 1))) ;; Make people do a little extra work (C-x C-q) ;; before altering a backup file. - (when (backup-file-name-p buffer-file-name) - (setq buffer-read-only t)) ;; When a file is marked read-only, ;; make the buffer read-only even if root is looking at it. - (when (and (file-modes (buffer-file-name)) - (zerop (logand (file-modes (buffer-file-name)) #o222))) - (setq buffer-read-only t)) + (unless buffer-read-only + (when (or (backup-file-name-p buffer-file-name) + (let ((modes (file-modes (buffer-file-name)))) + (and modes (zerop (logand modes #o222))))) + (setq buffer-read-only t))) (unless nomodes (when (and view-read-only view-mode) (view-mode -1)) |