emacs-devel
[Top][All Lists]
Advanced

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

Re: using libmagic in Emacs?


From: Stefan Monnier
Subject: Re: using libmagic in Emacs?
Date: Tue, 25 Aug 2009 13:36:27 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

> If some other Lisp code is interested in the mime type of a file,
> there is a much easier way to find it out: run `file'.

Actually, running `file' might be a useful fallback (especially if run
via process-file so it also works on remote files, contrary to
libmagic).

Also, looking at the way the magic database works, it seems that we
might want to run `file-type-by-magic' on a buffer's content as well.

As for Miles's suggestion to interpret the magic file directly, I think
it's a bad idea: let's not reinvent the wheel, the code that parses this
database and uses it already exists, it's in libmagic, so we should just
use it.


        Stefan




reply via email to

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