[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 59b849d1eaf: Run 'read-only-mode-hook' when visiting a file that
From: |
Eli Zaretskii |
Subject: |
master 59b849d1eaf: Run 'read-only-mode-hook' when visiting a file that is not writable |
Date: |
Sat, 10 Feb 2024 03:36:21 -0500 (EST) |
branch: master
commit 59b849d1eaffb8babb208f6a39c5e0dbc73e3127
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
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)
---
lisp/files.el | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lisp/files.el b/lisp/files.el
index 229771810fb..f67b650cb92 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 59b849d1eaf: Run 'read-only-mode-hook' when visiting a file that is not writable,
Eli Zaretskii <=