aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/image-mode.el31
-rw-r--r--lisp/image.el10
3 files changed, 32 insertions, 17 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 081583258b0..8b8f724da55 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,13 @@
12013-02-20 Glenn Morris <rgm@gnu.org> 12013-02-20 Glenn Morris <rgm@gnu.org>
2 2
3 * image.el (image-current-frame): Change from variable to function.
4 (image-show-frame): Rename from image-nth-frame. Update callers.
5 * image-mode.el (image-multi-frame): New variable.
6 (image-mode-map, image-mode, image-goto-frame):
7 Use image-multi-frame rather than image-current-frame.
8 (image-mode, image-goto-frame): Use image-current-frame as
9 function rather than as variable.
10
3 * emacs-lisp/cl-lib.el (cl-floatp-safe): Make it an alias for floatp. 11 * emacs-lisp/cl-lib.el (cl-floatp-safe): Make it an alias for floatp.
4 * emacs-lisp/cl-macs.el (cl--make-type-test) 12 * emacs-lisp/cl-macs.el (cl--make-type-test)
5 (cl--compiler-macro-assoc): Use floatp rather than cl-floatp-safe. 13 (cl--compiler-macro-assoc): Use floatp rather than cl-floatp-safe.
diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index 7787a26cc08..6ae1bb20cdc 100644
--- a/lisp/image-mode.el
+++ b/lisp/image-mode.el
@@ -329,6 +329,9 @@ call."
329 "The image type for the current Image mode buffer.") 329 "The image type for the current Image mode buffer.")
330(make-variable-buffer-local 'image-type) 330(make-variable-buffer-local 'image-type)
331 331
332(defvar-local image-multi-frame nil
333 "Non-nil if image for the current Image mode buffer has multiple frames.")
334
332(defvar image-mode-previous-major-mode nil 335(defvar image-mode-previous-major-mode nil
333 "Internal variable to keep the previous non-image major mode.") 336 "Internal variable to keep the previous non-image major mode.")
334 337
@@ -390,7 +393,7 @@ call."
390 ["Animate Image" image-toggle-animation :style toggle 393 ["Animate Image" image-toggle-animation :style toggle
391 :selected (let ((image (image-get-display-property))) 394 :selected (let ((image (image-get-display-property)))
392 (and image (image-animate-timer image))) 395 (and image (image-animate-timer image)))
393 :active image-current-frame 396 :active image-multi-frame
394 :help "Toggle image animation"] 397 :help "Toggle image animation"]
395 ["Loop Animation" 398 ["Loop Animation"
396 (lambda () (interactive) 399 (lambda () (interactive)
@@ -403,13 +406,13 @@ call."
403 (image-toggle-animation) 406 (image-toggle-animation)
404 (image-toggle-animation))) 407 (image-toggle-animation)))
405 :style toggle :selected image-animate-loop 408 :style toggle :selected image-animate-loop
406 :active image-current-frame 409 :active image-multi-frame
407 :help "Animate images once, or forever?"] 410 :help "Animate images once, or forever?"]
408 ["Next Frame" image-next-frame :active image-current-frame 411 ["Next Frame" image-next-frame :active image-multi-frame
409 :help "Show the next frame of this image"] 412 :help "Show the next frame of this image"]
410 ["Previous Frame" image-previous-frame :active image-current-frame 413 ["Previous Frame" image-previous-frame :active image-multi-frame
411 :help "Show the previous frame of this image"] 414 :help "Show the previous frame of this image"]
412 ["Goto Frame..." image-goto-frame :active image-current-frame 415 ["Goto Frame..." image-goto-frame :active image-multi-frame
413 :help "Show a specific frame of this image"] 416 :help "Show a specific frame of this image"]
414 )) 417 ))
415 map) 418 map)
@@ -471,12 +474,13 @@ to toggle between display as an image and display as text."
471 ((null image) 474 ((null image)
472 (message "%s" (concat msg1 "an image."))) 475 (message "%s" (concat msg1 "an image.")))
473 ((setq animated (image-multi-frame-p image)) 476 ((setq animated (image-multi-frame-p image))
474 (setq image-current-frame (or (plist-get (cdr image) :index) 0) 477 (setq image-multi-frame t
475 mode-line-process 478 mode-line-process
476 `(:eval (propertize (format " [%s/%s]" 479 `(:eval (propertize
477 (1+ image-current-frame) 480 (format " [%s/%s]"
478 ,(car animated)) 481 (1+ (image-current-frame ',image))
479 'help-echo "Frame number"))) 482 ,(car animated))
483 'help-echo "Frame number")))
480 (message "%s" 484 (message "%s"
481 (concat msg1 "text. This image has multiple frames."))) 485 (concat msg1 "text. This image has multiple frames.")))
482;;; (substitute-command-keys 486;;; (substitute-command-keys
@@ -694,10 +698,13 @@ current frame. Frames are indexed from 1."
694 (cond 698 (cond
695 ((null image) 699 ((null image)
696 (error "No image is present")) 700 (error "No image is present"))
697 ((null image-current-frame) 701 ((null image-multi-frame)
698 (message "No image animation.")) 702 (message "No image animation."))
699 (t 703 (t
700 (image-nth-frame image (if relative (+ n image-current-frame) (1- n))))))) 704 (image-show-frame image
705 (if relative
706 (+ n (image-current-frame image))
707 (1- n)))))))
701 708
702(defun image-next-frame (&optional n) 709(defun image-next-frame (&optional n)
703 "Switch to the next frame of a multi-frame image. 710 "Switch to the next frame of a multi-frame image.
diff --git a/lisp/image.el b/lisp/image.el
index b91d136443d..ec7b41bf126 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -660,10 +660,11 @@ number, play until that number of seconds has elapsed."
660(defconst image-minimum-frame-delay 0.01 660(defconst image-minimum-frame-delay 0.01
661 "Minimum interval in seconds between frames of an animated image.") 661 "Minimum interval in seconds between frames of an animated image.")
662 662
663(defvar-local image-current-frame nil 663(defun image-current-frame (image)
664 "The frame index of the current animated image.") 664 "The current frame number of IMAGE, indexed from 0."
665 (or (plist-get (cdr image) :index) 0))
665 666
666(defun image-nth-frame (image n &optional nocheck) 667(defun image-show-frame (image n &optional nocheck)
667 "Show frame N of IMAGE. 668 "Show frame N of IMAGE.
668Frames are indexed from 0. Optional argument NOCHECK non-nil means 669Frames are indexed from 0. Optional argument NOCHECK non-nil means
669do not check N is within the range of frames present in the image." 670do not check N is within the range of frames present in the image."
@@ -671,7 +672,6 @@ do not check N is within the range of frames present in the image."
671 (if (< n 0) (setq n 0) 672 (if (< n 0) (setq n 0)
672 (setq n (min n (1- (car (image-multi-frame-p image))))))) 673 (setq n (min n (1- (car (image-multi-frame-p image)))))))
673 (plist-put (cdr image) :index n) 674 (plist-put (cdr image) :index n)
674 (setq image-current-frame n)
675 (force-window-update)) 675 (force-window-update))
676 676
677;; 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,
@@ -688,7 +688,7 @@ LIMIT determines when to stop. If t, loop forever. If nil, stop
688 after displaying the last animation frame. Otherwise, stop 688 after displaying the last animation frame. Otherwise, stop
689 after LIMIT seconds have elapsed. 689 after LIMIT seconds have elapsed.
690The minimum delay between successive frames is `image-minimum-frame-delay'." 690The minimum delay between successive frames is `image-minimum-frame-delay'."
691 (image-nth-frame image n t) 691 (image-show-frame image n t)
692 (setq n (1+ n)) 692 (setq n (1+ n))
693 (let* ((time (float-time)) 693 (let* ((time (float-time))
694 (animation (image-multi-frame-p image)) 694 (animation (image-multi-frame-p image))