Run 'read-only-mode-hook' when visiting a file that is not writable
* lisp/files.el (after-find-file): Run 'read-only-mode-hook' when the visited file is not writable. (Bug#68648)
This commit is contained in:
parent
4330eb2864
commit
59b849d1ea
1 changed files with 4 additions and 0 deletions
|
@ -2747,6 +2747,10 @@ Fifth arg NOMODES non-nil means don't alter the file's modes.
|
|||
Finishes by calling the functions in `find-file-hook'
|
||||
unless NOMODES is non-nil."
|
||||
(setq buffer-read-only (not (file-writable-p buffer-file-name)))
|
||||
;; The above is sufficiently like turning on read-only-mode, so run
|
||||
;; the mode hook here by hand.
|
||||
(if buffer-read-only
|
||||
(run-hooks 'read-only-mode-hook))
|
||||
(if noninteractive
|
||||
nil
|
||||
(let* (not-serious
|
||||
|
|
Loading…
Add table
Reference in a new issue