summaryrefslogtreecommitdiff
path: root/lisp/files.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-08-24 13:33:02 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-08-24 13:39:41 +0200
commitfd74c6f4b81ffb6b373993ef2a5d80f888842397 (patch)
tree7ee0f5a5f365f02b76c58d511dae42ff0b1dd2f8 /lisp/files.el
parente518146a3017669981b6d31c356d0bb105200928 (diff)
downloademacs-fd74c6f4b81ffb6b373993ef2a5d80f888842397.tar.gz
emacs-fd74c6f4b81ffb6b373993ef2a5d80f888842397.tar.bz2
emacs-fd74c6f4b81ffb6b373993ef2a5d80f888842397.zip
When reverting, preserve the readedness state set by `C-x C-q'
* lisp/files.el (revert-buffer): Save the user's intention in a variable (bug#50431). * lisp/simple.el (read-only-mode): Use it.
Diffstat (limited to 'lisp/files.el')
-rw-r--r--lisp/files.el9
1 files changed, 7 insertions, 2 deletions
diff --git a/lisp/files.el b/lisp/files.el
index cf2a5221930..8596d9a8390 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -6627,9 +6627,14 @@ preserve markers and overlays, at the price of being slower."
;; interface, but leaving the programmatic interface the same.
(interactive (list (not current-prefix-arg)))
(let ((revert-buffer-in-progress-p t)
- (revert-buffer-preserve-modes preserve-modes))
+ (revert-buffer-preserve-modes preserve-modes)
+ (state (and (boundp 'read-only-mode--state)
+ (list read-only-mode--state))))
(funcall (or revert-buffer-function #'revert-buffer--default)
- ignore-auto noconfirm)))
+ ignore-auto noconfirm)
+ (when state
+ (setq buffer-read-only (car state))
+ (setq-local read-only-mode--state (car state)))))
(defun revert-buffer--default (ignore-auto noconfirm)
"Default function for `revert-buffer'.