summaryrefslogtreecommitdiff
path: root/lisp/net/shr.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2021-11-12 03:27:23 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2021-11-12 03:31:53 +0100
commita204b29d5ba01f382203686929fa367a9baa58d5 (patch)
tree320352bc9185dca149728415d5ca7b96a04aed04 /lisp/net/shr.el
parentfe0f7bddb648a75d1db4ea574536a207ea881712 (diff)
downloademacs-a204b29d5ba01f382203686929fa367a9baa58d5.tar.gz
emacs-a204b29d5ba01f382203686929fa367a9baa58d5.tar.bz2
emacs-a204b29d5ba01f382203686929fa367a9baa58d5.zip
Allow stopping animations automatically when the image disappears
* lisp/image.el (image-animate): Allow the animation to be stopped automatically when the image is removed from the buffer. (image-animate-timeout): Stop the animation if the image is removed (and that has been requested). * lisp/net/shr.el (shr-put-image): Stop animations if the image is removed.
Diffstat (limited to 'lisp/net/shr.el')
-rw-r--r--lisp/net/shr.el15
1 files changed, 8 insertions, 7 deletions
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 71c18ff9947..19d324b16f2 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -1174,13 +1174,14 @@ element is the data blob and the second element is the content-type."
(when (and (> (current-column) 0)
(> (car (image-size image t)) 400))
(insert "\n"))
- (if (eq size 'original)
- (insert-sliced-image image (or alt "*") nil 20 1)
- (insert-image image (or alt "*")))
- (put-text-property start (point) 'image-size size)
- (when (and shr-image-animate
- (cdr (image-multi-frame-p image)))
- (image-animate image nil 60)))
+ (let ((image-pos (point)))
+ (if (eq size 'original)
+ (insert-sliced-image image (or alt "*") nil 20 1)
+ (insert-image image (or alt "*")))
+ (put-text-property start (point) 'image-size size)
+ (when (and shr-image-animate
+ (cdr (image-multi-frame-p image)))
+ (image-animate image nil 60 image-pos))))
image)
(insert (or alt ""))))