emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: image.el doesn't associate image-mode with .JPG files


From: Juanma Barranquero
Subject: Re: image.el doesn't associate image-mode with .JPG files
Date: Tue, 19 Dec 2006 12:10:00 +0100

On 12/19/06, Kim F. Storm <address@hidden> wrote:

Installed.

Great.

BTW, as `magic-mode-alist' takes precedence over `auto-mode-alist',
perhaps we should make some of the regexps in
`image-type-header-regexp' somewhat less trigger-happy. I'm thinking
mostly of the one for pbm, which matches any file that starts with
P[1-6].

I propose the following patch (which also modifies the regexp for PNG
to use the full PNG header, according to spec).

                   /L/e/k/t/u


Index: lisp/image.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/image.el,v
retrieving revision 1.63
diff -u -2 -r1.63 image.el
--- lisp/image.el       21 Apr 2006 20:56:06 -0000      1.63
+++ lisp/image.el       19 Dec 2006 10:40:53 -0000
@@ -36,9 +36,9 @@
(defconst image-type-header-regexps
  '(("\\`/[\t\n\r ]*\\*.*XPM.\\*/" . xpm)
-    ("\\`P[1-6]" . pbm)
+    ("\\`P[1-6][[:space:]]+\\(?:#.*[[:space:]]+\\)*[0-9]+[[:space:]]+[0-9]+"
. pbm)
    ("\\`GIF8" . gif)
-    ("\\`\211PNG\r\n" . png)
+    ("\\`\x89PNG\r\n\x1a\n" . png)
    ("\\`[\t\n\r ]*#define" . xbm)
-    ("\\`\\(MM\0\\*\\|II\\*\0\\)" . tiff)
+    ("\\`\\(?:MM\0\\*\\|II\\*\0\\)" . tiff)
    ("\\`[\t\n\r ]*%!PS" . postscript)
    ("\\`\xff\xd8" . (image-jpeg-p . jpeg)))




reply via email to

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