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

From: Glenn Morris <[email-masked]>
Date: Mon, 30 Jan 2012 15:10:01 -0500

I've changed my mind. I wanted to document _why_ view-file checks for a
special mode-class, but I could find no logical explanation.
This check was added here:

2003-07-09  Richard M. Stallman  <rms at gnu.org>

    * view.el (view-file): If existing buffer's major mode is
    special, don't go into view mode.

Unfortunately this just tells us _what_ was done, not why.
Emacs 22's NEWS file says:

  *** M-x view-file and commands that use it now avoid interfering
  with special modes such as Tar mode.

The only relevant thing I could find from the Emacs mailing lists around
this time was:

http://lists.gnu.org/archive/html/bug-gnu-emacs/2003-07/msg00031.html

  Problem: in dired the user hits v instead of RET on some file.zip.
  This causes lots of Zip-Archive mode keys to be overridden by view
  mode keys.

This isn't compelling to me. I agree with the only posted response:

   No, you should use RET if you want to run dired-find-file, and v if
   you want to run dired-view-file.

Anyway, it doesn't make much sense to me to steal the special mode-class
that tar-mode happens to have and start using it for view-file as well
(and it has never been documented anywhere AFAICS).

This came up before in some long thread:
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=4896#153

  I think the right solution should be to let the major mode say
  explicitly that it is mutually-exclusive with view-mode.

It would seem better to have some new explicit property for this, rather
than stealing special mode-class.