emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using libmagic in Emacs?


From: Juri Linkov
Subject: Re: using libmagic in Emacs?
Date: Mon, 24 Aug 2009 03:17:18 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (x86_64-pc-linux-gnu)

> Whatever we do with the function `image-jpeg-p', we could easily make
> Emacs test these two bytes.  It makes no sense to install code to link
> with libmagic just to handle that and a few other similar things.
>
> Meanwhile, for operations less common and important than visiting a file,
> running `file' is easy to do.
>
> Combining those two approaches seems much better than adding code to
> link with libmagic.

Of course, before adding code to link with libmagic we should analyze
how useful it would be.  I see its usefulness at least in the following
areas:

1. Archive file types

A popular way to create new archive file types nowadays is to register
a new file extension with the old data compression and archive format.

For instance, Java archive files have the .jar extension but build on
the ZIP file format, so they can be visited in Emacs with the help of
`archive-mode'.  Enterprise Java archives with the .ear extension
and Web application Java archives with the .war extension all are
based on the ZIP file format as well as OpenDocument files with
extensions .odt .ods .odb .odp .odg .odf, Firefox add-ons (.xpi),
Keyhole Markup (.kmz), and many other file types that can be potentially
opened in Emacs if were identified as archive files by libmagic.

We can't track and add all new formats.  This is the main task of libmagic.

2. Image file types

Using ImageMagick in Emacs can support over 100 image file formats.
It won't possible to recognize all them without libmagic.

3. MIME-types handling

Emacs can process different MIME-type detected by libmagic.
Even when Emacs has no special handling for a file type, it is
still useful to let Emacs run an external program associated
with its MIME-type for users who prefer running programs
(including GUI programs) from Emacs instead of using a window
manager's application menu.

-- 
Juri Linkov
http://www.jurta.org/emacs/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]