]> git.eshelyaron.com Git - emacs.git/commitdiff
vc-find-revision-no-save: Finish entering read-only-mode
authorSean Whitton <spwhitton@spwhitton.name>
Fri, 4 Jul 2025 12:18:16 +0000 (13:18 +0100)
committerEshel Yaron <me@eshelyaron.com>
Wed, 23 Jul 2025 20:18:48 +0000 (22:18 +0200)
* 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

index 57c7c1bfbd1a25c03ad4a6564693459f827ccd17..8cc0aa98f677180b29032406933d80f273e11cf9 100644 (file)
@@ -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)