summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuanma Barranquero <lekktu@gmail.com>2011-03-22 14:10:43 +0100
committerJuanma Barranquero <lekktu@gmail.com>2011-03-22 14:10:43 +0100
commit5fd6245244e1ec0720a8236a90f352bc8921fa38 (patch)
tree5077f2185209ac0b542f1654999a50a7fe4eeaf6
parent9882e21494509f28d28319e911987764ba92610d (diff)
downloademacs-5fd6245244e1ec0720a8236a90f352bc8921fa38.tar.gz
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/ChangeLog7
-rw-r--r--lisp/image.el26
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 @@
+2011-03-22 Juanma Barranquero <lekktu@gmail.com>
+
+ * 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.
+
2011-03-22 Leo Liu <sdl.web@gmail.com>
* 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
with one argument, a string containing the image data. If PREDICATE returns
a non-nil value, TYPE is the image's type.")
-(defconst image-type-file-name-regexps
+(defvar image-type-file-name-regexps
'(("\\.png\\'" . png)
("\\.gif\\'" . gif)
("\\.jpe?g\\'" . jpeg)
@@ -710,17 +710,19 @@ shall be displayed."
;;;###autoload
(defun imagemagick-register-types ()
"Register the file types that ImageMagick is able to handle."
- (let ((im-types (imagemagick-types)))
- (dolist (im-inhibit imagemagick-types-inhibit)
- (setq im-types (remove im-inhibit im-types)))
- (dolist (im-type im-types)
- (let ((extension (downcase (symbol-name im-type))))
- (push
- (cons (concat "\\." extension "\\'") 'image-mode)
- auto-mode-alist)
- (push
- (cons (concat "\\." extension "\\'") 'imagemagick)
- image-type-file-name-regexps)))))
+ (if (fboundp 'imagemagick-types)
+ (let ((im-types (imagemagick-types)))
+ (dolist (im-inhibit imagemagick-types-inhibit)
+ (setq im-types (remove im-inhibit im-types)))
+ (dolist (im-type im-types)
+ (let ((extension (downcase (symbol-name im-type))))
+ (push
+ (cons (concat "\\." extension "\\'") 'image-mode)
+ auto-mode-alist)
+ (push
+ (cons (concat "\\." extension "\\'") 'imagemagick)
+ image-type-file-name-regexps))))
+ (error "Emacs was not built with ImageMagick support")))
(provide 'image)