Subject: Re: bug#10650: view-mode inconsistencies wrt special mode-class

From: Juri Linkov <[email-masked]>
Date: Thu, 02 Feb 2012 02:40:45 +0200

>> Personally I think a separate variable controlling which modes are
>> incompatible with view-mode would be better, but I'm not going to
>> complain if the definition of special modes is extended to cover this.
>
> I'm not sure exactly what's the idea with view-mode's use of special
> mode class, but IIUC it's that we don't want to enable view-mode in
> major modes that already have view-mode-like keybindings, which might
> boil down to something along the lines of "major modes which use
> suppress-keymap".

Without using the special mode class or adding a new separate variable,
the closest condition to match modes incompatible with view-mode would be:

  (and (buffer-file-name)
       (or (derived-mode-p 'special-mode)
           (equal (keymap-parent (current-local-map)) special-mode-map)))

What is worth to note is that these modes don't suppress the special-mode keymap,
but inherit from it and override most of its key bindings.

But this heuristics is too unreliable, so explicitly declaring
incompatible modes is better.