Subject: Re: bug#75993: Special mode-class for diff-mode

From: Juri Linkov <[email-masked]>
Date: Thu, 06 Feb 2025 19:17:11 +0200

>>>> I tested with special mode-class, and see no negative side effect.
>>>
>>> Have you tried to
>>>
>>>     (setq diff-default-read-only nil)
>>>     (setq view-read-only t)
>>>
>>> and then open a read-only `.patch` file?
>>> I think your patch will hinder
>>> the auto-activation of `view-mode` in that case.
>>
>> Indeed, `view-mode` is not activated in this case,
>> and this is the right thing to do to allow using
>> diff-mode single letters like 'w' (diff-kill-ring-save)
>> instead of overriding it with
>> 'View-scroll-page-backward-set-page-size'.
>
> Hmm... when you `(setq diff-default-read-only nil)`, `w` is not bound to
> `diff-kill-ring-save` but to `self-insert-command`, so I think we *do*
> want `view-read-only` to apply in this case.

`w` is bound to `diff-kill-ring-save` because of
the read-only file and therefore read-only buffer.

There is no place for view-mode keybindings
since there are only 2 states:

- editable where `w` is `self-insert-command`
- read-only where `w` is `diff-kill-ring-save`