]> git.eshelyaron.com Git - emacs.git/commitdiff
Correctly update image properties
authorManuel Giraud <manuel@ledu-giraud.fr>
Thu, 3 Oct 2024 14:20:19 +0000 (16:20 +0200)
committerEshel Yaron <me@eshelyaron.com>
Mon, 14 Oct 2024 17:38:49 +0000 (19:38 +0200)
* lisp/image-mode.el (image--update-properties): New function to
update image properties.
(image-toggle-display-image): Use it.  (Bug#73617)

(cherry picked from commit 0e9502b10e08d1c93fe9b134b8cf74eae42c1eae)

lisp/image-mode.el

index 7cf7845e9357ea8c95c5d7861055b299ef02428e..e75f6ea918f6098223b421dd97b665bede24ef00 100644 (file)
@@ -867,6 +867,13 @@ The limits are given by the user option
         (or (<= mw (* (car size) scale))
             (<= mh (* (cdr size) scale))))))
 
+(defun image--update-properties (image properties)
+  "Update IMAGE with the new PROPERTIES set."
+  (let (prop)
+    (while (setq prop (pop properties))
+      (plist-put (cdr image) prop (pop properties)))
+    image))
+
 (defun image-toggle-display-image ()
   "Show the image of the image file.
 Turn the image data into a real image, but only if the whole file
@@ -959,7 +966,7 @@ was inserted."
 
     ;; Discard any stale image data before looking it up again.
     (image-flush image)
-    (setq image (append image (image-transform-properties image)))
+    (setq image (image--update-properties image (image-transform-properties image)))
     (setq props
          `(display ,image
                    ;; intangible ,image