diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2022-08-24 13:33:02 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2022-08-24 13:39:41 +0200 |
commit | fd74c6f4b81ffb6b373993ef2a5d80f888842397 (patch) | |
tree | 7ee0f5a5f365f02b76c58d511dae42ff0b1dd2f8 /lisp/simple.el | |
parent | e518146a3017669981b6d31c356d0bb105200928 (diff) | |
download | emacs-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/simple.el')
-rw-r--r-- | lisp/simple.el | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 460aff8bd82..13d0d3b2414 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -10400,8 +10400,15 @@ command works by setting the variable `buffer-read-only', which does not affect read-only regions caused by text properties. To ignore read-only status in a Lisp program (whether due to text properties or buffer state), bind `inhibit-read-only' temporarily -to a non-nil value." +to a non-nil value. + +Reverting a buffer will keep the readedness state set by using +this command." :variable buffer-read-only + ;; We're saving this value here so that we can restore the + ;; readedness state after reverting the buffer to the value that's + ;; been explicitly set by the user. + (setq-local read-only-mode--state buffer-read-only) (cond ((and (not buffer-read-only) view-mode) (View-exit-and-edit) |