On 12/13/06, Jason Rumney <[EMAIL PROTECTED]> wrote:
The only problem with this method is that the actual regexp you need is more complex
Yes, I downloaded the spec; I was just being sloppy in discussing it. I'm not sure I like adding that to `magic-mode-alist'; why not PNG, GIF, TIFF and other easily recognizable formats?
image-jpeg-p has a much more relaxed check, basically "^\xFF\xD8\xFF[\xE0-\xEF]..+(JFIF|Exif)", but with the search for JFIF|Exif limited based on the first two bytes of the ..+ portion - which indicate the length of the file header.
Post-22.1, perhaps `magic-mode-alist' could be extended to also allow (MATCHER . FUNCTION) pairs (MATCHER being a predicate on the text of the current buffer, starting from the point) in addition to the current (REGEXP . FUNCTION). That would allow reusing `image-jpeg-p' (once suitable adapted). /L/e/k/t/u _______________________________________________ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug