Don't make buffer read-only when reverting if 'view-mode' was disabled

* lisp/view.el (view--disable): Reset 'read-only-mode--state'.
(Bug#81149)
This commit is contained in:
Eli Zaretskii 2026-05-30 13:17:00 +03:00
parent 2955b51e80
commit 69fd4b87f4

View file

@ -464,6 +464,10 @@ Entry to view-mode runs the normal hook `view-mode-hook'."
;; so that View mode stays off if read-only-mode is called.
(if (local-variable-p 'view-read-only)
(kill-local-variable 'view-read-only))
;; Reset the read-only state memory as well, so that 'revert-buffer'
;; won't make the buffer read-only again.
(if (local-variable-p 'read-only-mode--state)
(setq-local read-only-mode--state nil))
(if buffer-read-only
(setq buffer-read-only view-old-buffer-read-only)))