diff options
| author | Juri Linkov | 2007-08-25 14:05:49 +0000 |
|---|---|---|
| committer | Juri Linkov | 2007-08-25 14:05:49 +0000 |
| commit | 62564fc7e8a25622d32132c74007a1f70aedf9c6 (patch) | |
| tree | c4dddc8f04e461f050d59112885fc69cd3b12ff3 | |
| parent | 5b668628b7ba2280fee9d95af567f60c7c606eb6 (diff) | |
| download | emacs-62564fc7e8a25622d32132c74007a1f70aedf9c6.tar.gz emacs-62564fc7e8a25622d32132c74007a1f70aedf9c6.zip | |
(image-type-header-regexps): Use more complex regexp for svg.
(image-type-file-name-regexps): Add ("\\.svgz?\\'" . svg).
(image-type-auto-detectable): Add (svg . maybe).
| -rw-r--r-- | lisp/image.el | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lisp/image.el b/lisp/image.el index e00a50ddc03..e6c5b2e2d2c 100644 --- a/lisp/image.el +++ b/lisp/image.el | |||
| @@ -34,7 +34,7 @@ | |||
| 34 | 34 | ||
| 35 | 35 | ||
| 36 | (defconst image-type-header-regexps | 36 | (defconst image-type-header-regexps |
| 37 | '(("\\`/[\t\n\r ]*\\*.*XPM.\\*/" . xpm) | 37 | `(("\\`/[\t\n\r ]*\\*.*XPM.\\*/" . xpm) |
| 38 | ("\\`P[1-6][[:space:]]+\\(?:#.*[[:space:]]+\\)*[0-9]+[[:space:]]+[0-9]+" . pbm) | 38 | ("\\`P[1-6][[:space:]]+\\(?:#.*[[:space:]]+\\)*[0-9]+[[:space:]]+[0-9]+" . pbm) |
| 39 | ("\\`GIF8[79]a" . gif) | 39 | ("\\`GIF8[79]a" . gif) |
| 40 | ("\\`\x89PNG\r\n\x1a\n" . png) | 40 | ("\\`\x89PNG\r\n\x1a\n" . png) |
| @@ -44,7 +44,14 @@ static char \\1_bits" . xbm) | |||
| 44 | ("\\`\\(?:MM\0\\*\\|II\\*\0\\)" . tiff) | 44 | ("\\`\\(?:MM\0\\*\\|II\\*\0\\)" . tiff) |
| 45 | ("\\`[\t\n\r ]*%!PS" . postscript) | 45 | ("\\`[\t\n\r ]*%!PS" . postscript) |
| 46 | ("\\`\xff\xd8" . (image-jpeg-p . jpeg)) | 46 | ("\\`\xff\xd8" . (image-jpeg-p . jpeg)) |
| 47 | ("\\`<\\?xml " . svg)) | 47 | (,(let* ((incomment-re "\\(?:[^-]\\|-[^-]\\)") |
| 48 | (comment-re (concat "\\(?:!--" incomment-re "*-->[ \t\r\n]*<\\)"))) | ||
| 49 | (concat "\\(?:<\\?xml[ \t\r\n]+[^>]*>\\)?[ \t\r\n]*<" | ||
| 50 | comment-re "*" | ||
| 51 | "\\(?:!DOCTYPE[ \t\r\n]+[^>]*>[ \t\r\n]*<[ \t\r\n]*" comment-re "*\\)?" | ||
| 52 | "[Ss][Vv][Gg]")) | ||
| 53 | . svg) | ||
| 54 | ) | ||
| 48 | "Alist of (REGEXP . IMAGE-TYPE) pairs used to auto-detect image types. | 55 | "Alist of (REGEXP . IMAGE-TYPE) pairs used to auto-detect image types. |
| 49 | When the first bytes of an image file match REGEXP, it is assumed to | 56 | When the first bytes of an image file match REGEXP, it is assumed to |
| 50 | be of image type IMAGE-TYPE if IMAGE-TYPE is a symbol. If not a symbol, | 57 | be of image type IMAGE-TYPE if IMAGE-TYPE is a symbol. If not a symbol, |
| @@ -61,7 +68,9 @@ a non-nil value, TYPE is the image's type.") | |||
| 61 | ("\\.pbm\\'" . pbm) | 68 | ("\\.pbm\\'" . pbm) |
| 62 | ("\\.xbm\\'" . xbm) | 69 | ("\\.xbm\\'" . xbm) |
| 63 | ("\\.ps\\'" . postscript) | 70 | ("\\.ps\\'" . postscript) |
| 64 | ("\\.tiff?\\'" . tiff)) | 71 | ("\\.tiff?\\'" . tiff) |
| 72 | ("\\.svgz?\\'" . svg) | ||
| 73 | ) | ||
| 65 | "Alist of (REGEXP . IMAGE-TYPE) pairs used to identify image files. | 74 | "Alist of (REGEXP . IMAGE-TYPE) pairs used to identify image files. |
| 66 | When the name of an image file match REGEXP, it is assumed to | 75 | When the name of an image file match REGEXP, it is assumed to |
| 67 | be of image type IMAGE-TYPE.") | 76 | be of image type IMAGE-TYPE.") |
| @@ -78,6 +87,7 @@ be of image type IMAGE-TYPE.") | |||
| 78 | (xpm . nil) | 87 | (xpm . nil) |
| 79 | (jpeg . maybe) | 88 | (jpeg . maybe) |
| 80 | (tiff . maybe) | 89 | (tiff . maybe) |
| 90 | (svg . maybe) | ||
| 81 | (postscript . nil)) | 91 | (postscript . nil)) |
| 82 | "Alist of (IMAGE-TYPE . AUTODETECT) pairs used to auto-detect image files. | 92 | "Alist of (IMAGE-TYPE . AUTODETECT) pairs used to auto-detect image files. |
| 83 | \(See `image-type-auto-detected-p'). | 93 | \(See `image-type-auto-detected-p'). |