diff options
author | Chong Yidong <cyd@stupidchicken.com> | 2011-05-29 17:35:35 -0400 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2011-05-29 17:35:35 -0400 |
commit | e8cbec34e8ef069f54c1189a7b6109f768047be8 (patch) | |
tree | 1890ec0a32380fed7a288e602405ed14e1c30a5b /lisp/image-mode.el | |
parent | 34809aa6007e2c8ff75f9ec43500e6d34cc43aa3 (diff) | |
download | emacs-e8cbec34e8ef069f54c1189a7b6109f768047be8.tar.gz |
Fix animated gifs (Bug#6981).
* lisp/image-mode.el (image-toggle-display-image): Ensure that the
image spec passed to the animate timer is the same object as in
the the buffer's display property.
(image-transform-properties): Doc fix.
* lisp/image.el (image-animate-max-time): Default to nil.
* lisp/image.el (image-animate-max-time): Allow nil and t values.
Default to nil.
(create-animated-image): Doc fix.
(image-animate-start): Remove second arg; just use
image-animate-max-time.
(image-animate-timeout): Doc fix. Args changed.
Diffstat (limited to 'lisp/image-mode.el')
-rw-r--r-- | lisp/image-mode.el | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/lisp/image-mode.el b/lisp/image-mode.el index f4eb5eeaf45..145a15de246 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -484,18 +484,26 @@ was inserted." (buffer-substring-no-properties (point-min) (point-max))) filename)) (type (image-type file-or-data nil data-p)) - (image0 (create-animated-image file-or-data type data-p)) - (image (append image0 - (image-transform-properties image0))) - (props + ;; Don't use create-animated-image here; that would start the + ;; timer, which works by altering the spec destructively. + ;; But we still need to append the transformation properties, + ;; which would make a new list. + (image (create-image file-or-data type data-p)) + (inhibit-read-only t) + (buffer-undo-list t) + (modified (buffer-modified-p)) + props) + + (setq image (append image (image-transform-properties image))) + (setq props `(display ,image intangible ,image rear-nonsticky (display intangible) read-only t front-sticky (read-only))) - (inhibit-read-only t) - (buffer-undo-list t) - (modified (buffer-modified-p))) (image-flush image) + ;; Begin the animation, if any. + (image-animate-start image) + (let ((buffer-file-truename nil)) ; avoid changing dir mtime by lock_file (add-text-properties (point-min) (point-max) props) (restore-buffer-modified-p modified)) @@ -584,10 +592,13 @@ Its value should be one of the following: (defvar image-transform-rotation 0.0) (defun image-transform-properties (display) - "Rescale and/or rotate the current image. -The scale factor and rotation angle are given by the variables -`image-transform-resize' and `image-transform-rotation'. This -takes effect only if Emacs is compiled with ImageMagick support." + "Return rescaling/rotation properties for the Image mode buffer. +These properties are suitable for appending to an image spec; +they are determined by the variables `image-transform-resize' and +`image-transform-rotation'. + +Recaling and rotation properties only take effect if Emacs is +compiled with ImageMagick support." (let* ((size (image-size display t)) (height (cond |