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:
- Open Emacs 29.1 with no config (
emacs -Q
). I haven't tested this on other versions. - Visit an animated image file (example).
- Evaluate
(setq image-animate-loop t)
. - If the animation is not running, do
image-toggle-animation
(RET
). Then run any of the following commands:toggle-frame-maximized
,toggle-frame-fullscreen
, ordelete-other-windows
(the latter only if there are other windows open). RESULT: the animation stops. - 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. - Run any of the following commands:
image-increase-size
,image-decrease-size
,set-scale
,image-transform-fit-to-width
, orimage-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?