unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#14188: 24.3.50; ODF files and auto-mode-alist
@ 2013-04-11 19:55 Stephen Berman
  2013-04-11 20:14 ` Eli Zaretskii
  2013-04-17 13:43 ` Tassilo Horn
  0 siblings, 2 replies; 7+ messages in thread
From: Stephen Berman @ 2013-04-11 19:55 UTC (permalink / raw)
  To: 14188

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]\\|".


In GNU Emacs 24.3.50.1 (x86_64-suse-linux-gnu, GTK+ Version 3.4.4)
 of 2013-04-09 on rosalinde
Bzr revision: 112253 rgm@gnu.org-20130409101736-f1vzgrwt88suqqis
Windowing system distributor `The X.Org Foundation', version 11.0.11203000
System Description:	openSUSE 12.2 (x86_64)

Configured using:
 `configure --without-toolkit-scroll-bars CFLAGS=-g3 -O0'

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=local
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Footnotes: 
[1]  Actually, it only switches to the archive listing if the global
value of major-mode is fundamental-mode.  I don't know if this is a bug,
so I'll ask about it on emacs-devel. 






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#14188: 24.3.50; ODF files and auto-mode-alist
  2013-04-11 19:55 bug#14188: 24.3.50; ODF files and auto-mode-alist Stephen Berman
@ 2013-04-11 20:14 ` Eli Zaretskii
  2013-04-11 20:51   ` Stephen Berman
  2013-04-17 13:43 ` Tassilo Horn
  1 sibling, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2013-04-11 20:14 UTC (permalink / raw)
  To: Stephen Berman; +Cc: 14188

> From: Stephen Berman <stephen.berman@gmx.net>
> Date: Thu, 11 Apr 2013 21:55:24 +0200
> 
> 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]\\|".

doc-view-mode requires additional programs.  What if they are not
available?





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#14188: 24.3.50; ODF files and auto-mode-alist
  2013-04-11 20:14 ` Eli Zaretskii
@ 2013-04-11 20:51   ` Stephen Berman
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Berman @ 2013-04-11 20:51 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 14188

On Thu, 11 Apr 2013 23:14:05 +0300 Eli Zaretskii <eliz@gnu.org> wrote:

>> From: Stephen Berman <stephen.berman@gmx.net>
>> Date: Thu, 11 Apr 2013 21:55:24 +0200
>> 
>> 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]\\|".
>
> doc-view-mode requires additional programs.  What if they are not
> available?

The second pairing of ODF files in auto-mode-alist is not with
doc-view-mode but with doc-view-mode-maybe, whose doc string says
"Switch to `doc-view-mode' if possible.  If the required external tools
are not available, then fallback to the next best mode."  In this case
the next best mode is archive-mode, due to magic-fallback-mode-alist.
That's why the first pairing is dispensable.

Steve Berman





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#14188: 24.3.50; ODF files and auto-mode-alist
  2013-04-11 19:55 bug#14188: 24.3.50; ODF files and auto-mode-alist Stephen Berman
  2013-04-11 20:14 ` Eli Zaretskii
@ 2013-04-17 13:43 ` Tassilo Horn
  2013-04-17 18:30   ` Stephen Berman
  1 sibling, 1 reply; 7+ messages in thread
From: Tassilo Horn @ 2013-04-17 13:43 UTC (permalink / raw)
  To: Stephen Berman; +Cc: 14188

Stephen Berman <stephen.berman@gmx.net> 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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#14188: 24.3.50; ODF files and auto-mode-alist
  2013-04-17 13:43 ` Tassilo Horn
@ 2013-04-17 18:30   ` Stephen Berman
  2013-04-18  6:34     ` Tassilo Horn
  0 siblings, 1 reply; 7+ messages in thread
From: Stephen Berman @ 2013-04-17 18:30 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: 14188

On Wed, 17 Apr 2013 15:43:11 +0200 Tassilo Horn <tsdh@gnu.org> wrote:

> Stephen Berman <stephen.berman@gmx.net> 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.  

That's not the case for me, and I'd be surprised if it were for most
users.  I virtually always want to simply view the document's content in
Emacs.  I guess the only reason to want to open it in archive-mode is to
edit one of the XML source files, but since most or all of these are
formatted as one line, it isn't fun to edit the source.  Usually I edit
ODF files with LibreOffice.

>          doc-view-mode is arguably more heavy-weight, so probably
> archive-mode should stay the default.  

This is a strong argument, though not a knock-out argument, since if
most users are like me, they would toggle to the image anyway, so it
would be an extra step if archive-mode remained the default.  With
doc-view-mode-maybe the default, it's just as easy to toggle to
archive-mode, should you want to (which again, I seldom do).

>                                        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?

If the message really were what you wrote, I would find that
unacceptable.  But when I enable doc-view-minor-mode in archive-mode, I
see the message

  Type C-c C-c to toggle between editing or viewing the document.

This is acceptable (i.e., the key binding is IMO a must).  But again,
even better IMO would be to just have doc-view-mode-maybe, falling back
to archive-mode when you type C-c C-c.

Whichever decision you make, I do think you should do the same with MS
OpenXML (.docx, .xlsx) files, too.  (These are currently only paired
with doc-view-mode-maybe.)

Steve Berman





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#14188: 24.3.50; ODF files and auto-mode-alist
  2013-04-17 18:30   ` Stephen Berman
@ 2013-04-18  6:34     ` Tassilo Horn
  2013-04-18  7:56       ` Stephen Berman
  0 siblings, 1 reply; 7+ messages in thread
From: Tassilo Horn @ 2013-04-18  6:34 UTC (permalink / raw)
  To: Stephen Berman; +Cc: 14188-done

Stephen Berman <stephen.berman@gmx.net> writes:

Hi Stephen,

>> 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.
>
> That's not the case for me, and I'd be surprised if it were for most
> users.  I virtually always want to simply view the document's content
> in Emacs.  I guess the only reason to want to open it in archive-mode
> is to edit one of the XML source files, but since most or all of these
> are formatted as one line, it isn't fun to edit the source.  Usually I
> edit ODF files with LibreOffice.

Ok, that makes sense.

>> 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?
>
> If the message really were what you wrote, I would find that
> unacceptable.  But when I enable doc-view-minor-mode in archive-mode,
> I see the message
>
>   Type C-c C-c to toggle between editing or viewing the document.

Hm, I see the message with M-x when I open some file for the first time.
Thereafter, it shows the key binding instead...

> Whichever decision you make, I do think you should do the same with MS
> OpenXML (.docx, .xlsx) files, too.  (These are currently only paired
> with doc-view-mode-maybe.)

I've now committed the change you suggested initially, that is, I've
removed the OpenDocument and StarOffice file extensions from the
archive-mode entry.  One exception is *.OXT which is an OpenOffice
extension pack that has no visual representation.

So now doc-view-mode-maybe is the default for StarOffice/MSOffice/
OpenDocument files instead of archive-mode with the possibility of
falling back to that with a simple C-c C-c.

I'm closing this bug now.

Thanks,
Tassilo





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#14188: 24.3.50; ODF files and auto-mode-alist
  2013-04-18  6:34     ` Tassilo Horn
@ 2013-04-18  7:56       ` Stephen Berman
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Berman @ 2013-04-18  7:56 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: 14188-done

On Thu, 18 Apr 2013 08:34:18 +0200 Tassilo Horn <tsdh@gnu.org> wrote:

> I've now committed the change you suggested initially, that is, I've
> removed the OpenDocument and StarOffice file extensions from the
> archive-mode entry.  One exception is *.OXT which is an OpenOffice
> extension pack that has no visual representation.
>
> So now doc-view-mode-maybe is the default for StarOffice/MSOffice/
> OpenDocument files instead of archive-mode with the possibility of
> falling back to that with a simple C-c C-c.

Thanks!

Steve Berman





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-04-18  7:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-11 19:55 bug#14188: 24.3.50; ODF files and auto-mode-alist Stephen Berman
2013-04-11 20:14 ` Eli Zaretskii
2013-04-11 20:51   ` Stephen Berman
2013-04-17 13:43 ` Tassilo Horn
2013-04-17 18:30   ` Stephen Berman
2013-04-18  6:34     ` Tassilo Horn
2013-04-18  7:56       ` Stephen Berman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).