Merge changes from emacs-23 branch
[bpt/emacs.git] / lisp / image.el
index c686262..15b82d1 100644 (file)
@@ -1,6 +1,6 @@
 ;;; image.el --- image API
 
-;; Copyright (C) 1998-2011  Free Software Foundation, Inc.
+;; Copyright (C) 1998-2012  Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: multimedia
@@ -413,8 +413,8 @@ means display it in the right marginal area."
 (defun insert-image (image &optional string area slice)
   "Insert IMAGE into current buffer at point.
 IMAGE is displayed by inserting STRING into the current buffer
-with a `display' property whose value is the image.  STRING is
-defaulted if you omit it.
+with a `display' property whose value is the image.  STRING
+defaults to the empty string if you omit it.
 AREA is where to display the image.  AREA nil or omitted means
 display it in the text area, a value of `left-margin' means
 display it in the left marginal area, a value of `right-margin'
@@ -695,16 +695,14 @@ Emacs visits them in Image mode.
 
 If Emacs is compiled without ImageMagick support, do nothing."
   (when (fboundp 'imagemagick-types)
-    (let ((im-types (imagemagick-types)))
-      (dolist (im-inhibit imagemagick-types-inhibit)
-       (setq im-types (delq im-inhibit im-types)))
-      (dolist (im-type im-types)
-       (let ((extension
-              (concat "\\." (downcase (symbol-name im-type))
-                      "\\'")))
-         (push (cons extension 'image-mode) auto-mode-alist)
-         (push (cons extension 'imagemagick)
-               image-type-file-name-regexps))))))
+    (let ((im-types '()))
+      (dolist (im-type (imagemagick-types))
+        (unless (memq im-type imagemagick-types-inhibit)
+          (push (downcase (symbol-name im-type)) im-types)))
+      (let ((extension (concat "\\." (regexp-opt im-types) "\\'")))
+        (push (cons extension 'image-mode) auto-mode-alist)
+        (push (cons extension 'imagemagick)
+              image-type-file-name-regexps)))))
 
 (provide 'image)