unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* odt file instant open
@ 2010-07-26 16:29 Olwe Melwasul
  2010-07-27  7:30 ` Andreas Röhler
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Olwe Melwasul @ 2010-07-26 16:29 UTC (permalink / raw)
  To: help-gnu-emacs

I'm trying to grok the open document format, so I took the first wild
and crazy step of simply trying to open it in Emacs (23.2.1) -- and it
opened up to a "Zip-Archive Narrow" view of all the files contained
therein Poking around on the Internet, I found that Emacs
automatically unpacks a .odt file, which is nothing more than a zip
file. My question is this: How is Emacs doing this? What code is
running (what .el is invoked) to make this happen? Also, where might
documentation be on how to control this zip/unzip functionality with
elisp. I don't want to do a system call, i.e., reinvent the wheel.

O



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

* Re: odt file instant open
  2010-07-26 16:29 odt file instant open Olwe Melwasul
@ 2010-07-27  7:30 ` Andreas Röhler
  2010-07-27 10:33   ` Thien-Thi Nguyen
  2010-07-27 16:58   ` Eli Zaretskii
  2010-07-27 16:55 ` Eli Zaretskii
  2010-09-25  3:03 ` Jason White
  2 siblings, 2 replies; 11+ messages in thread
From: Andreas Röhler @ 2010-07-27  7:30 UTC (permalink / raw)
  To: help-gnu-emacs

Am 26.07.2010 18:29, schrieb Olwe Melwasul:
> I'm trying to grok the open document format, so I took the first wild
> and crazy step of simply trying to open it in Emacs (23.2.1) -- and it
> opened up to a "Zip-Archive Narrow" view of all the files contained
> therein Poking around on the Internet, I found that Emacs
> automatically unpacks a .odt file, which is nothing more than a zip
> file. My question is this: How is Emacs doing this?

by calling a shell-command resp. to the ending found.
Exists a list with endings --.zip, .tgz, .gz etc.-- and programs to run for.
Have a look at dired-do-compress for the details.

  What code is
> running (what .el is invoked)

probably dired-find-file

HTH


Andreas

--
https://code.launchpad.net/~a-roehler/python-mode
https://code.launchpad.net/s-x-emacs-werkstatt/

  to make this happen? Also, where might
> documentation be on how to control this zip/unzip functionality with
> elisp. I don't want to do a system call, i.e., reinvent the wheel.
>
> O
>
>




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

* Re: odt file instant open
  2010-07-27  7:30 ` Andreas Röhler
@ 2010-07-27 10:33   ` Thien-Thi Nguyen
  2010-07-27 16:58   ` Eli Zaretskii
  1 sibling, 0 replies; 11+ messages in thread
From: Thien-Thi Nguyen @ 2010-07-27 10:33 UTC (permalink / raw)
  To: help-gnu-emacs

See also variable ‘auto-mode-alist’.



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

* Re: odt file instant open
  2010-07-26 16:29 odt file instant open Olwe Melwasul
  2010-07-27  7:30 ` Andreas Röhler
@ 2010-07-27 16:55 ` Eli Zaretskii
  2010-09-25  3:03 ` Jason White
  2 siblings, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2010-07-27 16:55 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Mon, 26 Jul 2010 11:29:17 -0500
> From: Olwe Melwasul <hercynianforest@gmail.com>
> 
> My question is this: How is Emacs doing this? What code is
> running (what .el is invoked) to make this happen?

arc-mode.el

> Also, where might documentation be on how to control this zip/unzip
> functionality with elisp.

Read the code and comments of arc-mode.el.



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

* Re: odt file instant open
  2010-07-27  7:30 ` Andreas Röhler
  2010-07-27 10:33   ` Thien-Thi Nguyen
@ 2010-07-27 16:58   ` Eli Zaretskii
  2010-07-27 17:34     ` Andreas Röhler
       [not found]     ` <mailman.11.1280251781.6519.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 11+ messages in thread
From: Eli Zaretskii @ 2010-07-27 16:58 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Tue, 27 Jul 2010 09:30:32 +0200
> From: Andreas Röhler <andreas.roehler@easy-emacs.de>
> 
> Am 26.07.2010 18:29, schrieb Olwe Melwasul:
> > I'm trying to grok the open document format, so I took the first wild
> > and crazy step of simply trying to open it in Emacs (23.2.1) -- and it
> > opened up to a "Zip-Archive Narrow" view of all the files contained
> > therein Poking around on the Internet, I found that Emacs
> > automatically unpacks a .odt file, which is nothing more than a zip
> > file. My question is this: How is Emacs doing this?
> 
> by calling a shell-command resp. to the ending found.

No.  For most archive types, arc-mode.el (and tar-mode.el) can list
the contents directly, just by reading the archive file itself.
Extracting the individual files in the archive sometimes needs to run
an external program.




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

* Re: odt file instant open
  2010-07-27 16:58   ` Eli Zaretskii
@ 2010-07-27 17:34     ` Andreas Röhler
  2010-07-28 13:10       ` Kevin Rodgers
       [not found]     ` <mailman.11.1280251781.6519.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 11+ messages in thread
From: Andreas Röhler @ 2010-07-27 17:34 UTC (permalink / raw)
  To: help-gnu-emacs

Am 27.07.2010 18:58, schrieb Eli Zaretskii:
>> Date: Tue, 27 Jul 2010 09:30:32 +0200
>> From: Andreas Röhler<andreas.roehler@easy-emacs.de>
>>
>> Am 26.07.2010 18:29, schrieb Olwe Melwasul:
>>> I'm trying to grok the open document format, so I took the first wild
>>> and crazy step of simply trying to open it in Emacs (23.2.1) -- and it
>>> opened up to a "Zip-Archive Narrow" view of all the files contained
>>> therein Poking around on the Internet, I found that Emacs
>>> automatically unpacks a .odt file, which is nothing more than a zip
>>> file. My question is this: How is Emacs doing this?
>>
>> by calling a shell-command resp. to the ending found.
>
> No.  For most archive types, arc-mode.el (and tar-mode.el) can list
> the contents directly, just by reading the archive file itself.
> Extracting the individual files in the archive sometimes needs to run
> an external program.
>
>
>

Hi,

think you mistook the question.
As the OP wrote, he just opened the file without any precaution. The 
surprise was: it worked.

Ignoring so for how opening was done in detail --via find-file or from 
dired probably-- arc-mode seems not involved, but auto-compression-mode 
from jka-cmpr-hook.el etc.

BTW arc-mode too recurs to shell-commands AFAIS,
	  (apply 'call-process
in archive-*-extract for example

Andreas




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

* Re: odt file instant open
       [not found]     ` <mailman.11.1280251781.6519.help-gnu-emacs@gnu.org>
@ 2010-07-27 20:53       ` Stefan Monnier
  0 siblings, 0 replies; 11+ messages in thread
From: Stefan Monnier @ 2010-07-27 20:53 UTC (permalink / raw)
  To: help-gnu-emacs

> Ignoring so for how opening was done in detail --via find-file or from dired
> probably-- arc-mode seems not involved, but auto-compression-mode from
> jka-cmpr-hook.el etc.

No: jka-compr is only used for compression-only format, like gzip,
compress, bzip, lzma, ... for archives of files (compressed or not),
it's either tar-mode (used for tarballs) or arc-mode (used for ar, zip,
lha, zoo, ...).

> BTW arc-mode too recurs to shell-commands AFAIS,
> 	  (apply 'call-process
> in archive-*-extract for example

Yes, that's what Eli said:

   Extracting the individual files in the archive sometimes needs to run
   tan external program.


-- Stefan


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

* Re: odt file instant open
  2010-07-27 17:34     ` Andreas Röhler
@ 2010-07-28 13:10       ` Kevin Rodgers
  2010-07-28 14:32         ` Andreas Röhler
       [not found]         ` <mailman.4.1280327317.17798.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 11+ messages in thread
From: Kevin Rodgers @ 2010-07-28 13:10 UTC (permalink / raw)
  To: help-gnu-emacs

Andreas Röhler wrote:
> Am 27.07.2010 18:58, schrieb Eli Zaretskii:
>>> Date: Tue, 27 Jul 2010 09:30:32 +0200
>>> From: Andreas Röhler<andreas.roehler@easy-emacs.de>
>>>
>>> Am 26.07.2010 18:29, schrieb Olwe Melwasul:
>>>> I'm trying to grok the open document format, so I took the first wild
>>>> and crazy step of simply trying to open it in Emacs (23.2.1) -- and it
>>>> opened up to a "Zip-Archive Narrow" view of all the files contained
>>>> therein Poking around on the Internet, I found that Emacs
>>>> automatically unpacks a .odt file, which is nothing more than a zip
>>>> file. My question is this: How is Emacs doing this?
>>>
>>> by calling a shell-command resp. to the ending found.
>>
>> No.  For most archive types, arc-mode.el (and tar-mode.el) can list
>> the contents directly, just by reading the archive file itself.
>> Extracting the individual files in the archive sometimes needs to run
>> an external program.
> 
> Hi,
> 
> think you mistook the question.
> As the OP wrote, he just opened the file without any precaution. The 
> surprise was: it worked.
> 
> Ignoring so for how opening was done in detail --via find-file or from 
> dired probably--

I think you misread the question, that is exactly what the OP asked about:

How is Emacs doing this? What code is
running (what .el is invoked) to make this happen?

> arc-mode seems not involved, but auto-compression-mode 
> from jka-cmpr-hook.el etc.

This entry from auto-mode-alist suggests otherwise:

  ("\\.\\(sx[dmicw]\\|od[fgpst]\\|oxt\\)\\'" . archive-mode)

> BTW arc-mode too recurs to shell-commands AFAIS,
>       (apply 'call-process
> in archive-*-extract for example

Good point, which Eli made above as well.  Here's what arc-mode.el says:

;; This code does not decode any files internally, although it does
;; understand the directory level of the archives.

-- 
Kevin Rodgers
Denver, Colorado, USA




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

* Re: odt file instant open
  2010-07-28 13:10       ` Kevin Rodgers
@ 2010-07-28 14:32         ` Andreas Röhler
       [not found]         ` <mailman.4.1280327317.17798.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 11+ messages in thread
From: Andreas Röhler @ 2010-07-28 14:32 UTC (permalink / raw)
  To: help-gnu-emacs

Am 28.07.2010 15:10, schrieb Kevin Rodgers:
> Andreas Röhler wrote:
>> Am 27.07.2010 18:58, schrieb Eli Zaretskii:
>>>> Date: Tue, 27 Jul 2010 09:30:32 +0200
>>>> From: Andreas Röhler<andreas.roehler@easy-emacs.de>
>>>>
>>>> Am 26.07.2010 18:29, schrieb Olwe Melwasul:
>>>>> I'm trying to grok the open document format, so I took the first wild
>>>>> and crazy step of simply trying to open it in Emacs (23.2.1) -- and it
>>>>> opened up to a "Zip-Archive Narrow" view of all the files contained
>>>>> therein Poking around on the Internet, I found that Emacs
>>>>> automatically unpacks a .odt file, which is nothing more than a zip
>>>>> file. My question is this: How is Emacs doing this?
>>>>
>>>> by calling a shell-command resp. to the ending found.
>>>
>>> No. For most archive types, arc-mode.el (and tar-mode.el) can list
>>> the contents directly, just by reading the archive file itself.
>>> Extracting the individual files in the archive sometimes needs to run
>>> an external program.
>>
>> Hi,
>>
>> think you mistook the question.
>> As the OP wrote, he just opened the file without any precaution. The
>> surprise was: it worked.
>>
>> Ignoring so for how opening was done in detail --via find-file or from
>> dired probably--
>
> I think you misread the question, that is exactly what the OP asked about:
>
> How is Emacs doing this? What code is
> running (what .el is invoked) to make this happen?
>
>> arc-mode seems not involved, but auto-compression-mode from
>> jka-cmpr-hook.el etc.
>
> This entry from auto-mode-alist suggests otherwise:
>
> ("\\.\\(sx[dmicw]\\|od[fgpst]\\|oxt\\)\\'" . archive-mode)
>

You are right here, Eli too. So the mistake is mine in this point.
.odt is handled differently from other archives as


  ("\\.g?z\\(~\\|\\.~[0-9]+~\\)?\\'" nil jka-compr)
  ("\\.bz2\\(~\\|\\.~[0-9]+~\\)?\\'" nil jka-compr)
  ("\\.Z\\(~\\|\\.~[0-9]+~\\)?\\'" nil jka-compr)

where I poked around some weeks ago...

Thanks

Andreas



>> BTW arc-mode too recurs to shell-commands AFAIS,
>> (apply 'call-process
>> in archive-*-extract for example
>
> Good point, which Eli made above as well. Here's what arc-mode.el says:
>
> ;; This code does not decode any files internally, although it does
> ;; understand the directory level of the archives.
>




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

* Re: odt file instant open
       [not found]         ` <mailman.4.1280327317.17798.help-gnu-emacs@gnu.org>
@ 2010-07-28 23:08           ` Stefan Monnier
  0 siblings, 0 replies; 11+ messages in thread
From: Stefan Monnier @ 2010-07-28 23:08 UTC (permalink / raw)
  To: help-gnu-emacs

> You are right here, Eli too. So the mistake is mine in this point.
> .odt is handled differently from other archives as

>  ("\\.g?z\\(~\\|\\.~[0-9]+~\\)?\\'" nil jka-compr)
>  ("\\.bz2\\(~\\|\\.~[0-9]+~\\)?\\'" nil jka-compr)
>  ("\\.Z\\(~\\|\\.~[0-9]+~\\)?\\'" nil jka-compr)

Because these are not archives, but compressed files (they contain only
a single file, whereas archives typically contain several files).
Of course many .gz files have as their single "contained" file an
archive (or format Tar) which itself contains several file.


        Stefan


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

* Re: odt file instant open
  2010-07-26 16:29 odt file instant open Olwe Melwasul
  2010-07-27  7:30 ` Andreas Röhler
  2010-07-27 16:55 ` Eli Zaretskii
@ 2010-09-25  3:03 ` Jason White
  2 siblings, 0 replies; 11+ messages in thread
From: Jason White @ 2010-09-25  3:03 UTC (permalink / raw)
  To: help-gnu-emacs

Olwe Melwasul <hercynianforest@gmail.com> writes:

> I'm trying to grok the open document format, so I took the first wild
> and crazy step of simply trying to open it in Emacs (23.2.1) -- and it
> opened up to a "Zip-Archive Narrow" view of all the files contained
> therein 

The following may be useful:
http://www.cb1.com/~john/computing/emacs/lisp/editing/odf-mode.el




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

end of thread, other threads:[~2010-09-25  3:03 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-26 16:29 odt file instant open Olwe Melwasul
2010-07-27  7:30 ` Andreas Röhler
2010-07-27 10:33   ` Thien-Thi Nguyen
2010-07-27 16:58   ` Eli Zaretskii
2010-07-27 17:34     ` Andreas Röhler
2010-07-28 13:10       ` Kevin Rodgers
2010-07-28 14:32         ` Andreas Röhler
     [not found]         ` <mailman.4.1280327317.17798.help-gnu-emacs@gnu.org>
2010-07-28 23:08           ` Stefan Monnier
     [not found]     ` <mailman.11.1280251781.6519.help-gnu-emacs@gnu.org>
2010-07-27 20:53       ` Stefan Monnier
2010-07-27 16:55 ` Eli Zaretskii
2010-09-25  3:03 ` Jason White

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).