I've noticed that image animation produces strangely inconsistent behavior when changing window or frame state, depending on which command was most recently used to display or redisplay the image.

Steps to replicate:

  1. Open Emacs 29.1 with no config (emacs -Q). I haven't tested this on other versions.
  2. Visit an animated image file (example).
  3. Evaluate (setq image-animate-loop t).
  4. If the animation is not running, do image-toggle-animation (RET). Then run any of the following commands: toggle-frame-maximized, toggle-frame-fullscreen, or delete-other-windows (the latter only if there are other windows open). RESULT: the animation stops.
  5. Run any of the following commands: image-transform-fit-to-window, image-transform-fit-both, or (find-alternate-file (buffer-file-name)) (i.e. (C-x C-v RET), then repeat step 4. RESULT: The animation stops as before.
  6. Run any of the following commands: image-increase-size, image-decrease-size, set-scale, image-transform-fit-to-width, or image-transform-fit-to-height, then repeat step 4. RESULT: The animation does not stop, but keeps running.

I've looked at the definitions for these commands in image-mode.el and image.el, and I don't see anything obvious that would cause this discrepancy. For example, image-transform-fit-to-width and image-transform-fit-to-height give different results from image-transform-fit-both and image-transform-fit-window, but all of those commands work by simply setting the variable image-transform-resize followed by a call to image-toggle-display-image. What could be the cause of this behavior?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.