[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: recognizing a file by scanning it
From: |
Stefan Monnier |
Subject: |
Re: recognizing a file by scanning it |
Date: |
Mon, 28 Apr 2008 10:52:40 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
> file(1) contains a rather complete set of such heuristics and
> has been stable for a long time. AFAIK libmagic is free and
> GPL-compatible.
> Yes, i believe so. My concern w/ using libmagic would be
> portability, and handling the case where libmagic is not
> available. I envision the feature to be non-optional.
Would could like we do for `ls': use libmagic if it's available and
fallback on an Elisp replacement if not. The Elisp replacement would
need to work even in the absence of /etc/magic.
The higher-level functionality also needs adjusting: we want to bring
magic-mode-alist and auto-mode-alist to the same level (rather than give
absolute priority to one of the two). Basically, try them both, each
one can return a set/list of potential modes, then try and figure out
which mode to use (I've done something similar in doc-view-mode).
Hopefully this can be used to disambiguate the .arc archives from the
.arc Lisp files as well.
> Also, it might be nice if you could call this facility from
> coding systems (after all, what else is a BOM but file magic?)
> This kind of thing really doesn't need to be in Lisp, and might
> benefit from being in C.
> Certainly, in C it can be much faster.
If it's used just to choose the major-mode, speed is a non-issue.
Stefan
- recognizing a file by scanning it, Thien-Thi Nguyen, 2008/04/27
- recognizing a file by scanning it, Stephen J. Turnbull, 2008/04/27
- Re: recognizing a file by scanning it, Jason Rumney, 2008/04/27
- Re: recognizing a file by scanning it, Chong Yidong, 2008/04/27
- Re: recognizing a file by scanning it, Jason Rumney, 2008/04/27
- Re: recognizing a file by scanning it, Thien-Thi Nguyen, 2008/04/27
- Re: recognizing a file by scanning it, Jason Rumney, 2008/04/28
- Re: recognizing a file by scanning it, Reiner Steib, 2008/04/28
- Re: recognizing a file by scanning it, Jason Rumney, 2008/04/28