* net/shr.el (shr-put-image): add custom variable
authorIvan Kanis <ivan@tao.kanis.fr>
Fri, 28 Feb 2014 08:49:59 +0000 (09:49 +0100)
committerIvan Kanis <ivan@tao.kanis.fr>
Fri, 28 Feb 2014 08:49:59 +0000 (09:49 +0100)
  `shr-image-animate' to turn off image animation. It is so slow it
  will render emacs unusable.

lisp/ChangeLog
lisp/net/shr.el

index 08960c8..6c645e7 100644 (file)
@@ -1,3 +1,9 @@
+2014-02-28  Ivan Kanis  <ivan@kanis.fr>
+
+       * net/shr.el (shr-put-image): add custom variable
+       `shr-image-animate' to turn off image animation. It is so slow it
+       will render emacs unusable.
+
 2014-02-28  Michael Albinus  <michael.albinus@gmx.de>
 
        * net/tramp-adb.el (tramp-adb-parse-device-names):
index f23faaa..c7f8c0f 100644 (file)
@@ -100,6 +100,12 @@ Alternative suggestions are:
   :group 'shr
   :type 'function)
 
+(defcustom shr-image-animate t
+  "If non nil image will be animated."
+  :version "24.4"
+  :group 'shr
+  :type 'boolean)
+
 (defvar shr-content-function nil
   "If bound, this should be a function that will return the content.
 This is used for cid: URLs, and the function is called with the
@@ -765,14 +771,15 @@ element is the data blob and the second element is the content-type."
              (insert-sliced-image image (or alt "*") nil 20 1)
            (insert-image image (or alt "*")))
          (put-text-property start (point) 'image-size size)
-         (when (cond ((fboundp 'image-multi-frame-p)
+         (when (and shr-image-animate
+                     (cond ((fboundp 'image-multi-frame-p)
                       ;; Only animate multi-frame things that specify a
                       ;; delay; eg animated gifs as opposed to
                       ;; multi-page tiffs.  FIXME?
-                      (cdr (image-multi-frame-p image)))
-                     ((fboundp 'image-animated-p)
-                      (image-animated-p image)))
-           (image-animate image nil 60)))
+                            (cdr (image-multi-frame-p image)))
+                           ((fboundp 'image-animated-p)
+                            (image-animated-p image))))
+            (image-animate image nil 60)))
        image)
     (insert alt)))