]> code.delx.au - gnu-emacs/blobdiff - lisp/image.el
* lisp/electric.el (electric-pair-pairs): New var.
[gnu-emacs] / lisp / image.el
index 963093c614957edc3ad888b0b39e75d50c940b4c..f93fd03fba35d041f806fa82a9eb436963f05097 100644 (file)
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: multimedia
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -30,6 +31,7 @@
   "Image support."
   :group 'multimedia)
 
+(defalias 'image-refresh 'image-flush)
 
 (defconst image-type-header-regexps
   `(("\\`/[\t\n\r ]*\\*.*XPM.\\*/" . xpm)
@@ -328,14 +330,16 @@ Optional DATA-P non-nil means SOURCE is a string containing image data."
   type)
 
 
-(defvar image-library-alist)
+(define-obsolete-variable-alias
+    'image-library-alist
+    'dynamic-library-alist "24.1")
 
 ;;;###autoload
 (defun image-type-available-p (type)
   "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 image-library-alist)))
+       (init-image-library type dynamic-library-alist)))
 
 
 ;;;###autoload
@@ -615,7 +619,7 @@ Images should not be larger than specified by `max-image-size'."
     (let* ((animate (memq type image-animated-types))
           (image
            (append (list 'image :type type (if data-p :data :file) file-or-data)
-                   (if animate '(:index 0 :mask heuristic))
+                   (if animate '(:index 0))
                    props)))
       (if animate
          (image-animate-start image))
@@ -684,36 +688,40 @@ shall be displayed."
     (let* ((metadata (image-metadata image))
           (images (plist-get metadata 'count))
           (extdata (plist-get metadata 'extension-data))
-          (anim (plist-get extdata #xF9)))
-      (and (integerp images) (> images 1)
-          (stringp anim) (>= (length anim) 4)
-          (cons images (+ (aref anim 1) (* (aref anim 2) 256))))))))
+          (anim (plist-get extdata #xF9))
+          (tmo (and (integerp images) (> images 1)
+                    (stringp anim) (>= (length anim) 4)
+                    (+ (aref anim 1) (* (aref anim 2) 256)))))
+      (when tmo
+       (if (eq tmo 0) (setq tmo 10))
+       (cons images tmo))))))
 
 \f
-(defconst imagemagick-types-inhibit
-  '(C HTML HTM TXT)
-  "Types the imagemagic loader should not try to handle.")
+(defcustom imagemagick-types-inhibit
+  '(C HTML HTM TXT PDF)
+  ;; FIXME what are the possible options?
+  ;; Are these actually file-name extensions?
+  ;; Why are these upper-case when eg image-types is lower-case?
+  "Types the ImageMagick loader should not try to handle."
+  :type '(choice (const :tag "Let ImageMagick handle all the types it can" nil)
+                (repeat symbol))
+  :version "24.1"
+  :group 'image)
 
 ;;;###autoload
-(defun imagemagic-register-types ()
-  "Register file types that imagemagick is able to handle."
-  (let ((im-types (imagemagick-types))
-        (im-inhibit imagemagick-types-inhibit))
-    (while im-inhibit
-      (setq im-types (remove (car im-inhibit) im-types))
-      (setq im-inhibit (cdr im-inhibit)))
-    (while im-types
-      (let
-         ((extension (downcase (symbol-name (car im-types)))))
+(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)
+        (cons (concat "\\." extension "\\'") 'image-mode)
         auto-mode-alist)
        (push
-        (cons  (concat "\\." extension "\\'") 'imagemagick)
-        image-type-file-name-regexps)
-       (setq im-types (cdr im-types))))))
-
-
+        (cons (concat "\\." extension "\\'") 'imagemagick)
+        image-type-file-name-regexps)))))
 
 (provide 'image)