emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r103714: lisp/image.el: Avoid some wa


From: Juanma Barranquero
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103714: lisp/image.el: Avoid some warnings.
Date: Tue, 22 Mar 2011 14:10:43 +0100
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 103714
committer: Juanma Barranquero <address@hidden>
branch nick: trunk
timestamp: Tue 2011-03-22 14:10:43 +0100
message:
  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.
modified:
  lisp/ChangeLog
  lisp/image.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-03-22 11:51:48 +0000
+++ b/lisp/ChangeLog    2011-03-22 13:10:43 +0000
@@ -1,3 +1,10 @@
+2011-03-22  Juanma Barranquero  <address@hidden>
+
+       * 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  <address@hidden>
 
        * net/rcirc.el (rcirc-completion-at-point): Return nil if point is

=== modified file 'lisp/image.el'
--- a/lisp/image.el     2011-01-25 04:08:28 +0000
+++ b/lisp/image.el     2011-03-22 13:10:43 +0000
@@ -60,7 +60,7 @@
 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 @@
 ;;;###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)
 


reply via email to

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