emacs-devel
[Top][All Lists]
Advanced

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

Re: using libmagic in Emacs?


From: Richard Stallman
Subject: Re: using libmagic in Emacs?
Date: Sun, 23 Aug 2009 20:07:18 -0400

    The problem is that `image-jpeg-p' in image.el refuses to accept
    non-JFIF JPEG image files whereas Emacs can correctly display them
    when tests in `image-jpeg-p' are ignored.

    Using libmagic means looking only for 2 bytes 0xffd8 (a magic number
    of JPEG files) as described by the magic number file:

      0 beshort         0xffd8          JPEG image data

    It seems this is enough to determine JPEG files.  But I'm not confident
    about removing additional tests from `image-jpeg-p'.  We could keep the
    current rules in image.el as a fall-back when libmagic is not available.

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.




reply via email to

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