diff options
| author | Juanma Barranquero | 2011-03-22 14:10:43 +0100 |
|---|---|---|
| committer | Juanma Barranquero | 2011-03-22 14:10:43 +0100 |
| commit | 5fd6245244e1ec0720a8236a90f352bc8921fa38 (patch) | |
| tree | 5077f2185209ac0b542f1654999a50a7fe4eeaf6 | |
| parent | 9882e21494509f28d28319e911987764ba92610d (diff) | |
| download | emacs-5fd6245244e1ec0720a8236a90f352bc8921fa38.tar.gz emacs-5fd6245244e1ec0720a8236a90f352bc8921fa38.zip | |
lisp/image.el: Avoid some warnings.
* image.el (image-type-file-name-regexps): Make it variable.
`imagemagick-register-types' modifies it, and the user may want
to add new extensions for known image types.
(imagemagick-register-types): Throw error if not using ImageMagick.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/image.el | 26 |
2 files changed, 21 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index aecd90674fb..f2d2a21eaa4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2011-03-22 Juanma Barranquero <lekktu@gmail.com> | ||
| 2 | |||
| 3 | * image.el (image-type-file-name-regexps): Make it variable. | ||
| 4 | `imagemagick-register-types' modifies it, and the user may want | ||
| 5 | to add new extensions for known image types. | ||
| 6 | (imagemagick-register-types): Throw error if not using ImageMagick. | ||
| 7 | |||
| 1 | 2011-03-22 Leo Liu <sdl.web@gmail.com> | 8 | 2011-03-22 Leo Liu <sdl.web@gmail.com> |
| 2 | 9 | ||
| 3 | * net/rcirc.el (rcirc-completion-at-point): Return nil if point is | 10 | * net/rcirc.el (rcirc-completion-at-point): Return nil if point is |
diff --git a/lisp/image.el b/lisp/image.el index 627d4c69e44..3b90ac46bd1 100644 --- a/lisp/image.el +++ b/lisp/image.el | |||
| @@ -60,7 +60,7 @@ IMAGE-TYPE must be a pair (PREDICATE . TYPE). PREDICATE is called | |||
| 60 | with one argument, a string containing the image data. If PREDICATE returns | 60 | with one argument, a string containing the image data. If PREDICATE returns |
| 61 | a non-nil value, TYPE is the image's type.") | 61 | a non-nil value, TYPE is the image's type.") |
| 62 | 62 | ||
| 63 | (defconst image-type-file-name-regexps | 63 | (defvar image-type-file-name-regexps |
| 64 | '(("\\.png\\'" . png) | 64 | '(("\\.png\\'" . png) |
| 65 | ("\\.gif\\'" . gif) | 65 | ("\\.gif\\'" . gif) |
| 66 | ("\\.jpe?g\\'" . jpeg) | 66 | ("\\.jpe?g\\'" . jpeg) |
| @@ -710,17 +710,19 @@ shall be displayed." | |||
| 710 | ;;;###autoload | 710 | ;;;###autoload |
| 711 | (defun imagemagick-register-types () | 711 | (defun imagemagick-register-types () |
| 712 | "Register the file types that ImageMagick is able to handle." | 712 | "Register the file types that ImageMagick is able to handle." |
| 713 | (let ((im-types (imagemagick-types))) | 713 | (if (fboundp 'imagemagick-types) |
| 714 | (dolist (im-inhibit imagemagick-types-inhibit) | 714 | (let ((im-types (imagemagick-types))) |
| 715 | (setq im-types (remove im-inhibit im-types))) | 715 | (dolist (im-inhibit imagemagick-types-inhibit) |
| 716 | (dolist (im-type im-types) | 716 | (setq im-types (remove im-inhibit im-types))) |
| 717 | (let ((extension (downcase (symbol-name im-type)))) | 717 | (dolist (im-type im-types) |
| 718 | (push | 718 | (let ((extension (downcase (symbol-name im-type)))) |
| 719 | (cons (concat "\\." extension "\\'") 'image-mode) | 719 | (push |
| 720 | auto-mode-alist) | 720 | (cons (concat "\\." extension "\\'") 'image-mode) |
| 721 | (push | 721 | auto-mode-alist) |
| 722 | (cons (concat "\\." extension "\\'") 'imagemagick) | 722 | (push |
| 723 | image-type-file-name-regexps))))) | 723 | (cons (concat "\\." extension "\\'") 'imagemagick) |
| 724 | image-type-file-name-regexps)))) | ||
| 725 | (error "Emacs was not built with ImageMagick support"))) | ||
| 724 | 726 | ||
| 725 | (provide 'image) | 727 | (provide 'image) |
| 726 | 728 | ||