Subject: Re: bug#11412: 24.0.95; auto-revert-mode doesn't revert buffer when file becomes writeable

From: Lars Ingebrigtsen <[email-masked]>
Date: Wed, 02 Jun 2021 08:24:02 +0200

Barry OReilly <[email-masked]> writes:

> Open foo.py in Emacs.
>
> In a terminal:
> chmod u+w foo.py
>
> Wait several seconds, inserting text yields error:
> Buffer is read-only: #<buffer foo.py>

(I'm going through old bug reports that unfortunately got no response at
the time.)

This has been fixed in the years since this was reported.

> Open foo.py with vim and add text:
> # aaa blah
> # bbb
>
> The blah string appears in Emacs.  Insertion still fails with error:
> Buffer is read-only: #<buffer foo.py>
>
> Do: M-x revert-buffer
>
> Insertion now works.

This is apparently a feature added in 2004:

commit 90e118abf2dcc4aca4d7a7642247fa488554351e
Author:     Luc Teirlinck <[email-masked]>
AuthorDate: Fri Sep 3 22:28:10 2004 +0000

        ;; Bind buffer-read-only in case user has done C-x C-q, so as
        ;; not to forget that.  This gives undesirable results when
        ;; the file's mode changes, but that is less common.
        (let ((buffer-read-only buffer-read-only))
           ...
            (revert-buffer 'ignore-auto 'dont-ask 'preserve-modes))))

So auto-reversion doesn't touch the buffer-readedness in case the user
has set it manually.  So I'm not sure whether we should change this
behaviour here.  Anybody got an opinion?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no