From 16d1c4fa75b8cff98df4b713660f0edfca8e85a1 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Fri, 4 Jul 2025 13:18:16 +0100 Subject: [PATCH] vc-find-revision-no-save: Finish entering read-only-mode * lisp/vc/vc.el (vc-find-revision-no-save): After setting buffer-read-only to non-nil, also run read-only-mode-hook, and if view-read-only is non-nil, call view-mode-enter. (cherry picked from commit 215fc3a354c36b2294b3dd45e72555bb4b4cb364) --- lisp/vc/vc.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 57c7c1bfbd1..8cc0aa98f67 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2707,6 +2707,11 @@ Unlike `vc-find-revision-save', doesn't save the buffer to the file." (normal-mode (not enable-local-variables))) (set-buffer-modified-p nil) (setq buffer-read-only t) + (run-hooks 'read-only-mode-hook) + (when (and view-read-only + (not view-mode) + (not (eq (get major-mode 'mode-class) 'special))) + (view-mode-enter)) (setq failed nil)) (when (and failed (unless buffer (get-file-buffer filename))) (with-current-buffer (get-file-buffer filename) -- 2.39.5