]> code.delx.au - gnu-emacs/blobdiff - lisp/image.el
Correct non-standard binding of report-emacs-bug-insert-to-mailer.
[gnu-emacs] / lisp / image.el
index fc3c90e548d096d1e64f17276f8d1c6cb968532b..9be1d6a16396fabef3c3e4188a775b0dce53203f 100644 (file)
@@ -1,6 +1,6 @@
 ;;; image.el --- image API
 
-;; Copyright (C) 1998-2012 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2013 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: multimedia
@@ -308,8 +308,17 @@ be determined."
   "Determine the type of image file FILE from its name.
 Value is a symbol specifying the image type, or nil if type cannot
 be determined."
-  (assoc-default file image-type-file-name-regexps 'string-match-p))
-
+  (let (type first)
+    (or
+     (catch 'found
+       (dolist (elem image-type-file-name-regexps)
+        (when (string-match-p (car elem) file)
+          (setq type (cdr elem))
+          (or first (setq first type))
+          (if (image-type-available-p type)
+              (throw 'found type)))))
+     ;; If nothing seems to be supported, return the first type that matched.
+     first)))
 
 ;;;###autoload
 (defun image-type (source &optional type data-p)
@@ -346,7 +355,7 @@ Optional DATA-P non-nil means SOURCE is a string containing image data."
   "Return non-nil if image type TYPE is available.
 Image types are symbols like `xbm' or `jpeg'."
   (and (fboundp 'init-image-library)
-       (init-image-library type dynamic-library-alist)))
+       (init-image-library type)))
 
 
 ;;;###autoload
@@ -423,7 +432,7 @@ means display it in the right marginal area."
   "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
-defaults to the empty string if you omit it.
+defaults to a single space 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'
@@ -461,8 +470,8 @@ height of the image; integer values are taken as pixel values."
 (defun insert-sliced-image (image &optional string area rows cols)
   "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.  The default
+STRING is a single space.
 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'
@@ -645,8 +654,8 @@ number, play until that number of seconds has elapsed."
     (while tail
       (setq timer (car tail)
            tail (cdr tail))
-      (if (and (eq (aref timer 5) 'image-animate-timeout)
-              (eq (car-safe (aref timer 6)) image))
+      (if (and (eq (timer--function timer) 'image-animate-timeout)
+              (eq (car-safe (timer--args timer)) image))
          (setq tail nil)
        (setq timer nil)))
     timer))
@@ -747,7 +756,10 @@ If Emacs is compiled without ImageMagick support, this does nothing."
          (push (cons re 'image-mode) auto-mode-alist))
        (if itfnr-elt
            (setcar itfnr-elt re)
-         (push (cons re 'imagemagick) image-type-file-name-regexps)))
+         ;; Append to `image-type-file-name-regexps', so that we
+         ;; preferentially use specialized image libraries.
+         (add-to-list 'image-type-file-name-regexps
+                      (cons re 'imagemagick) t)))
       (setq imagemagick--file-regexp re))))
 
 (defcustom imagemagick-types-inhibit
@@ -771,11 +783,11 @@ has no effect."
   :set (lambda (symbol value)
         (set-default symbol value)
         (imagemagick-register-types))
-  :version "24.2"
+  :version "24.3"
   :group 'image)
 
 (defcustom imagemagick-enabled-types
-  '(3FR ART ARW AVS BMP BMP2 BMP3 CAL CALS CIN CMYK CMYKA CR2 CRW
+  '(3FR ART ARW AVS BMP BMP2 BMP3 CAL CALS CMYK CMYKA CR2 CRW
     CUR CUT DCM DCR DCX DDS DJVU DNG DPX EXR FAX FITS GBR GIF
     GIF87 GRB HRZ ICB ICO ICON J2C JNG JP2 JPC JPEG JPG JPX K25
     KDC MIFF MNG MRW MSL MSVG MTV NEF ORF OTB PBM PCD PCDS PCL
@@ -795,7 +807,7 @@ to enable all types that ImageMagick supports.
 
 The variable `imagemagick-types-inhibit' overrides this variable.
 
-If you change this without outside of Customize, you must call
+If you change this without using customize, you must call
 `imagemagick-register-types' afterwards.
 
 If Emacs is compiled without ImageMagick support, this variable
@@ -809,7 +821,7 @@ has no effect."
   :set (lambda (symbol value)
         (set-default symbol value)
         (imagemagick-register-types))
-  :version "24.2"
+  :version "24.3"
   :group 'image)
 
 (imagemagick-register-types)