GNU bug report logs -
#75993
Special mode-class for diff-mode
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Sat, 1 Feb 2025 17:37:01 UTC
Severity: normal
Tags: patch
Fixed in version 31.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
Message #11 received at 75993 <at> debbugs.gnu.org (full text, mbox):
>> Visiting a diff file and trying to copy lines with 'w' (diff-kill-ring-save)
>> does something unexpected since view-mode overrides 'w' with
>> 'View-scroll-page-backward-set-page-size' for non-nil 'view-read-only'.
>>
>> Here is the fix like for all modes that use single-letter keys:
> [...]
>> +(put 'diff-mode 'mode-class 'special)
>> ;;;###autoload
>> (define-derived-mode diff-mode fundamental-mode "Diff"
>> "Major mode for viewing/editing context diffs.
>
> Hmm... this doesn't smell right:
>
> - I hate distinguishing between "mode-class = special" and "derives from
> `special-mode`".
> - Whether we want to do that depends on `diff-mode-read-only` which is
> buffer-local.
AFAICS, the special mode-class is handled only in `read-only-mode`:
((and buffer-read-only view-read-only
(not view-mode)
(not (eq (get major-mode 'mode-class) 'special)))
(view-mode-enter))
This is exactly what is needed in diff-mode when it switches to read-only
it should not enable view-mode.
This bug report was last modified 103 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.