aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/NEWS2
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/gnus/ChangeLog5
-rw-r--r--lisp/gnus/shr.el3
-rw-r--r--lisp/image-mode.el10
-rw-r--r--lisp/image.el45
6 files changed, 45 insertions, 30 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 62d84a0788d..2eda7a5c775 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -145,6 +145,8 @@ directory, respectively.
145`f' (`image-next-frame') and `b' (`image-previous-frame') visit the 145`f' (`image-next-frame') and `b' (`image-previous-frame') visit the
146next or previous frame. `F' (`image-goto-frame') shows a specific frame. 146next or previous frame. `F' (`image-goto-frame') shows a specific frame.
147 147
148*** `image-animated-p' is now `image-multi-frame-p'.
149
148--- 150---
149*** The command `image-mode-fit-frame' deletes other windows. 151*** The command `image-mode-fit-frame' deletes other windows.
150When toggling, it restores the frame's previous window configuration. 152When toggling, it restores the frame's previous window configuration.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 17ecbd8bf31..66c18a25803 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,15 @@
12013-02-16 Glenn Morris <rgm@gnu.org> 12013-02-16 Glenn Morris <rgm@gnu.org>
2 2
3 * image.el (image-animated-types): Remove.
4 (image-multi-frame-p): Rename from image-animated-p, and generalize.
5 (image-animated-p): Make obsolete alias.
6 (image-animate, image-nth-frame, image-animate-timeout):
7 Use image-multi-frame-p.
8 (image-animate-timeout): If no delay, use image-default-frame-delay.
9 * image-mode.el (image-mode, image-toggle-animation):
10 Use image-multi-frame-p. (Bug#763, bug#10739)
11 (image-mode): Adjust startup message for a multi-frame image.
12
3 * image-mode.el (image-mode-map): Give it a menu. 13 * image-mode.el (image-mode-map): Give it a menu.
4 14
52013-02-16 Michael Albinus <michael.albinus@gmx.de> 152013-02-16 Michael Albinus <michael.albinus@gmx.de>
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index b6e8fd976d3..5030da87672 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,8 @@
12013-02-16 Glenn Morris <rgm@gnu.org>
2
3 * shr.el (shr-put-image): Only animate images that specify a delay.
4 This is consistent with the old image-animated-p behavior.
5
12013-02-14 Katsumi Yamaoka <yamaoka@jpl.org> 62013-02-14 Katsumi Yamaoka <yamaoka@jpl.org>
2 7
3 * gnus-util.el (gnus-define-keys): Convert [?\S-\ ] to [(shift space)] 8 * gnus-util.el (gnus-define-keys): Convert [?\S-\ ] to [(shift space)]
diff --git a/lisp/gnus/shr.el b/lisp/gnus/shr.el
index c9bf324b4fa..1294ca7cd69 100644
--- a/lisp/gnus/shr.el
+++ b/lisp/gnus/shr.el
@@ -615,7 +615,8 @@ size, and full-buffer size."
615 (overlay-put overlay 'face 'default))) 615 (overlay-put overlay 'face 'default)))
616 (insert-image image (or alt "*"))) 616 (insert-image image (or alt "*")))
617 (put-text-property start (point) 'image-size size) 617 (put-text-property start (point) 'image-size size)
618 (when (image-animated-p image) 618 ;; Only animate multi-frame things that specify a delay. FIXME?
619 (when (cdr (image-animated-p image))
619 (image-animate image nil 60))) 620 (image-animate image nil 60)))
620 image) 621 image)
621 (insert alt))) 622 (insert alt)))
diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index b6298adeb7e..52367811341 100644
--- a/lisp/image-mode.el
+++ b/lisp/image-mode.el
@@ -464,7 +464,7 @@ to toggle between display as an image and display as text."
464 (cond 464 (cond
465 ((null image) 465 ((null image)
466 (message "%s" (concat msg1 "an image."))) 466 (message "%s" (concat msg1 "an image.")))
467 ((setq animated (image-animated-p image)) 467 ((setq animated (image-multi-frame-p image))
468 (setq image-current-frame (or (plist-get (cdr image) :index) 0) 468 (setq image-current-frame (or (plist-get (cdr image) :index) 0)
469 mode-line-process 469 mode-line-process
470 `(:eval (propertize (format " [%s/%s]" 470 `(:eval (propertize (format " [%s/%s]"
@@ -472,9 +472,9 @@ to toggle between display as an image and display as text."
472 ,(car animated)) 472 ,(car animated))
473 'help-echo "Frame number"))) 473 'help-echo "Frame number")))
474 (message "%s" 474 (message "%s"
475 (concat msg1 "text, or " 475 (concat msg1 "text. This image has multiple frames.")))
476 (substitute-command-keys 476;;; (substitute-command-keys
477 "\\[image-toggle-animation] to animate.")))) 477;;; "\\[image-toggle-animation] to animate."))))
478 (t 478 (t
479 (message "%s" (concat msg1 "text.")))))) 479 (message "%s" (concat msg1 "text."))))))
480 480
@@ -663,7 +663,7 @@ Otherwise it plays once, then stops."
663 (cond 663 (cond
664 ((null image) 664 ((null image)
665 (error "No image is present")) 665 (error "No image is present"))
666 ((null (setq animation (image-animated-p image))) 666 ((null (setq animation (image-multi-frame-p image)))
667 (message "No image animation.")) 667 (message "No image animation."))
668 (t 668 (t
669 (let ((timer (image-animate-timer image))) 669 (let ((timer (image-animate-timer image)))
diff --git a/lisp/image.el b/lisp/image.el
index 22c6bdf4207..b91d136443d 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -606,29 +606,25 @@ Example:
606 606
607;;; Animated image API 607;;; Animated image API
608 608
609(defconst image-animated-types '(gif)
610 "List of supported animated image types.")
611
612(defvar image-default-frame-delay 0.1 609(defvar image-default-frame-delay 0.1
613 "Default interval in seconds between frames of a multi-frame image. 610 "Default interval in seconds between frames of a multi-frame image.
614Only used if the image does not specify a value.") 611Only used if the image does not specify a value.")
615 612
616(defun image-animated-p (image) 613(defun image-multi-frame-p (image)
617 "Return non-nil if IMAGE can be animated. 614 "Return non-nil if IMAGE contains more than one frame.
618To be capable of being animated, an image must be of a type 615The actual return value is a cons (NIMAGES . DELAY), where NIMAGES is
619listed in `image-animated-types', and contain more than one 616the number of frames (or sub-images) in the image and DELAY is the delay
620sub-image, with a specified animation delay. The actual return 617in seconds that the image specifies between each frame. DELAY may be nil,
621value is a cons (NIMAGES . DELAY), where NIMAGES is the number 618in which case you might want to use `image-default-frame-delay'."
622of sub-images in the animated image and DELAY is the delay in 619 (let* ((metadata (image-metadata image))
623seconds until the next sub-image should be displayed." 620 (images (plist-get metadata 'count))
624 (cond 621 (delay (plist-get metadata 'delay)))
625 ((memq (plist-get (cdr image) :type) image-animated-types) 622 (when (and images (> images 1))
626 (let* ((metadata (image-metadata image)) 623 (if (or (not (numberp delay)) (< delay 0))
627 (images (plist-get metadata 'count)) 624 (setq delay image-default-frame-delay))
628 (delay (plist-get metadata 'delay))) 625 (cons images delay))))
629 (when (and images (> images 1) (numberp delay)) 626
630 (if (< delay 0) (setq delay image-default-frame-delay)) 627(define-obsolete-function-alias 'image-animated-p 'image-multi-frame-p "24.4")
631 (cons images delay))))))
632 628
633;; "Destructively"? 629;; "Destructively"?
634(defun image-animate (image &optional index limit) 630(defun image-animate (image &optional index limit)
@@ -639,7 +635,7 @@ With optional INDEX, begin animating from that animation frame.
639LIMIT specifies how long to animate the image. If omitted or 635LIMIT specifies how long to animate the image. If omitted or
640nil, play the animation until the end. If t, loop forever. If a 636nil, play the animation until the end. If t, loop forever. If a
641number, play until that number of seconds has elapsed." 637number, play until that number of seconds has elapsed."
642 (let ((animation (image-animated-p image)) 638 (let ((animation (image-multi-frame-p image))
643 timer) 639 timer)
644 (when animation 640 (when animation
645 (if (setq timer (image-animate-timer image)) 641 (if (setq timer (image-animate-timer image))
@@ -673,13 +669,13 @@ Frames are indexed from 0. Optional argument NOCHECK non-nil means
673do not check N is within the range of frames present in the image." 669do not check N is within the range of frames present in the image."
674 (unless nocheck 670 (unless nocheck
675 (if (< n 0) (setq n 0) 671 (if (< n 0) (setq n 0)
676 (setq n (min n (1- (car (image-animated-p image))))))) 672 (setq n (min n (1- (car (image-multi-frame-p image)))))))
677 (plist-put (cdr image) :index n) 673 (plist-put (cdr image) :index n)
678 (setq image-current-frame n) 674 (setq image-current-frame n)
679 (force-window-update)) 675 (force-window-update))
680 676
681;; FIXME? The delay may not be the same for different sub-images, 677;; FIXME? The delay may not be the same for different sub-images,
682;; hence we need to call image-animated-p to return it. 678;; hence we need to call image-multi-frame-p to return it.
683;; But it also returns count, so why do we bother passing that as an 679;; But it also returns count, so why do we bother passing that as an
684;; argument? 680;; argument?
685(defun image-animate-timeout (image n count time-elapsed limit) 681(defun image-animate-timeout (image n count time-elapsed limit)
@@ -695,10 +691,11 @@ The minimum delay between successive frames is `image-minimum-frame-delay'."
695 (image-nth-frame image n t) 691 (image-nth-frame image n t)
696 (setq n (1+ n)) 692 (setq n (1+ n))
697 (let* ((time (float-time)) 693 (let* ((time (float-time))
698 (animation (image-animated-p image)) 694 (animation (image-multi-frame-p image))
699 ;; Subtract off the time we took to load the image from the 695 ;; Subtract off the time we took to load the image from the
700 ;; stated delay time. 696 ;; stated delay time.
701 (delay (max (+ (cdr animation) time (- (float-time))) 697 (delay (max (+ (or (cdr animation) image-default-frame-delay)
698 time (- (float-time)))
702 image-minimum-frame-delay)) 699 image-minimum-frame-delay))
703 done) 700 done)
704 (if (>= n count) 701 (if (>= n count)