[Top][All Lists]

[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, 31 Aug 2009 19:19:59 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (x86_64-pc-linux-gnu)

> No one has yet explained why we shouldn't deal with such failures by
> simply fixing Emacs' file detection, instead of relying on libmagic or
> file.  Given that libmagic/file isn't always going to be present, and
> there's no intention of removing our file detection code, why not make
> sure the latter works?

Sure, we need to support the existing file detection code for the case
of absent libmagic/file.  This means manually copying necessary parts
of the magic database to `magic-fallback-mode-alist',
`image-type-header-regexps', `archive-find-type'.

> Are there any situations we are inherently incapable of detecting,
> and why?

One situation is when the number of formats to copy from the magic
database is too high, e.g. for all ImageMagick formats.

Also the magic database has simple rules for detecting C, Lisp and
Perl programs, but these rules are unreliable.

Another useful case for libmagic/file is getting MIME types and mailcap
commands to run on them as demonstrated by my patch.  But it seems this
feature is not too important to justify adding libmagic to Emacs instead
of running `file'.

Juri Linkov

reply via email to

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