Subject: Re: bug#61652: 28.2; Read-only mode and View mode

From: Bernd Rellermeyer <[email-masked]>
Date: Tue, 21 Feb 2023 13:46:50 +0100

In step 3, View mode is entered implicitly, because `view-read-only` is non-nil. From the user perspective it is only one command. I.e. the user just turns off and on Read-only mode. That means the user enters View mode vie Read-Only mode from a writable buffer. I think this should not alter the behavior of `View-exit` and after calling `View-exit` he should be in a writable buffer. Or am I wrong?

> Am 20.02.2023 um 15:42 schrieb Eli Zaretskii <[email-masked]>:
> 
>> From: Bernd Rellermeyer <[email-masked]>
>> Date: Mon, 20 Feb 2023 09:41:33 +0100
>> 
>> 
>> I have the following scenario:
>> 
>> 1. View a buffer in View mode.
>> 2. Turn off Read-Only mode, e.g. by pressing `C-x C-q`.
>> 3. Turn on Read-Only mode and View mode again, eg. by pressing `C-x
>> C-q`-
>> 4. Exit View mode by `View-exit`, e.g. by pressing `e`.
>> 
>> Now the buffer is in Read-Only mode. In my opinion it should be
>> writable. The reason is the variable `view-old-buffer-read-only`, which
>> is set on entering View mode (`view--enable`) to the (old) value of
>> `buffer-read-only`. But in my scenario, the value of `buffer-read-only`
>> is already the new one, as set in `read-only-mode`.
> 
> If the buffer is already read-only when you enter View mode, why
> should we reset read-only when exiting View mode?  We are trying to
> leave the buffer as we found it, which in this case is read-only.
> 
> Or what am I missing?