Function: image--set-speed

image--set-speed is a byte-compiled function defined in image-mode.el.gz.

Signature

(image--set-speed SPEED &optional MULTIPLY)

Documentation

Set speed of an animated image to SPEED.

If MULTIPLY is non-nil, treat SPEED as a multiplication factor. If SPEED is reset, reset the magnitude of the speed to 1.

Source Code

;; Defined in /usr/src/emacs/lisp/image-mode.el.gz
(defun image--set-speed (speed &optional multiply)
  "Set speed of an animated image to SPEED.
If MULTIPLY is non-nil, treat SPEED as a multiplication factor.
If SPEED is `reset', reset the magnitude of the speed to 1."
  (let ((image (image-get-display-property)))
    (cond
     ((null image)
      (error "No image is present"))
     ((null image-multi-frame)
      (message "No image animation."))
     (t
      (if (eq speed 'reset)
	  (setq speed (if (< (image-animate-get-speed image) 0)
			  -1 1)
		multiply nil))
      (image-animate-set-speed image speed multiply)
      ;; FIXME Hack to refresh an active image.
      (when (image-animate-timer image)
	(image-toggle-animation)
	(image-toggle-animation))
      (message "Image speed is now %s" (image-animate-get-speed image))))))