Subject: bug#78124: 30.1; `revert-buffer' regression

From: Eli Zaretskii <[email-masked]>
Date: Tue, 29 Apr 2025 09:22:29 +0300

tags 78124 notabug
thanks

> Date: Mon, 28 Apr 2025 23:20:37 +0000
> From:  Drew Adams via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <[email-masked]>
> 
> I didn't find anything about this in NEWS, so I'm assuming this change
> in behavior isn't intended.  And I HOPE it's not intended.
> 
> emacs -Q
> 
> Visit any file, say foo.el.
> 
> Use `C-x C-q' to make the buffer read-only.
> 
> M-: (revert-buffer t t)
> 
> The buffer should be changed back to writable, but it remains
> read-only.  This is not the case in any prior Emacs release.

This is a (new) feature.  The behavior change was in Emacs 29, where
we have this in NEWS:

  ** Explicitly-set read-only state is preserved when reverting a buffer.
  If you use the 'C-x C-q' command to change the read-only state of the
  buffer and then revert it, Emacs would previously use the file
  permission bits to determine whether the buffer should be read-only
  after reverting the buffer.  Emacs now remembers the decision made in
  'C-x C-q'.

The change was (briefly) discussed in bug#35166.

If you want back the previous behavior, you can define your own
function that is the value of revert-buffer-restore-functions (e.g.,
set it to nil).

> I bind this command to F5, so the key reverts, as on Windows:
> 
> (defun revert-buffer-no-confirm ()
>   "Revert buffer without confirmation."
>   (interactive) (revert-buffer t t))
> 
> Useless now.

You can change that trivially to restore the behavior you expect.