From fcae435f598471a2911641412125c5ac4f73559f Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 22 Jul 2021 16:24:58 +0200 Subject: [PATCH] Make revert-buffer preserve buffer-readedness * lisp/files.el (revert-buffer): Preserve buffer-readedness (bug#35166). --- etc/NEWS | 3 +++ lisp/files.el | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/etc/NEWS b/etc/NEWS index bf19c34f021..95218faa1b6 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2804,6 +2804,9 @@ similar to prefix arguments, but are more flexible and discoverable. * Incompatible Editing Changes in Emacs 28.1 +** 'revert-buffer' will now preserve buffer-readedness. +It previously switched the read-only flag off. + ** 'electric-indent-mode' now also indents inside strings and comments, (unless the indentation function doesn't, of course). To recover the previous behavior you can use: diff --git a/lisp/files.el b/lisp/files.el index 0606ed64823..412562fc9a3 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -6317,7 +6317,9 @@ 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) + ;; Preserve buffer-readedness. + (buffer-read-only buffer-read-only)) (funcall (or revert-buffer-function #'revert-buffer--default) ignore-auto noconfirm))) -- 2.39.2