Subject: Re: bug#14188: 24.3.50; ODF files and auto-mode-alist

From: Tassilo Horn <[email-masked]>
Date: Wed, 17 Apr 2013 15:43:11 +0200

Stephen Berman <[email-masked]> writes:

> The extension .od[fgpst] for ODF files occurs twice as part of a key
> in the default value of auto-mode-alist, paired first with
> archive-mode and later with doc-view-mode-maybe.  As a result,
> visiting such a file shows the directory-style listing of the archive
> instead of the files content.  To see the latter, you have to
> explicitly invoke doc-view-mode.  But if .od[fgpst] is removed from
> the key paired with archive-mode, then visiting such a file shows the
> content after conversion, and when you type C-c C-c, it switches to
> the archive listing, due to magic-fallback-mode-alist.[1] I think this
> is better behavior.  I can't test files with the other extensions in
> the problematic entry ("\\.\\(sx[dmicw]\\|od[fgpst]\\|oxt\\)\\'"
> . archive-mode), so I don't know if the whole entry should be deleted
> or only "od[fgpst]\\|".

Hm, I think for OpenDocument files, the alternatives of a user wanting
to view the file using archive-mode and doc-view-mode are equally
likely.  doc-view-mode is arguably more heavy-weight, so probably
archive-mode should stay the default.  But it should be easier and
obvious to start doc-view-mode from there.

So how about using the PS (PostScript) approach also here?  That is, we
remove the ODF regexes for doc-view-mode-maybe from auto-mode-alist, and
in archive-mode we check if the current archive is an ODF file, and if
so, enable doc-view-minor-mode.

This would message

  Type M-x doc-view-toggle-display to toggle between editing or viewing
  the document.

thus indicating to the user how he can view the document with doc-view
instead of editing it as an archive.

Does that sound reasonable?

Bye,
Tassilo