Subject: bug#73617: closed (Re: bug#73617: [PATCH] Correctly update image properties)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 12 Oct 2024 11:38:02 +0000

Your bug report

#73617: [PATCH] Correctly update image properties

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
73617: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=73617
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#73617: [PATCH] Correctly update image properties
From: Eli Zaretskii <[email-masked]>
To: Manuel Giraud <[email-masked]>
Cc: [email-masked]
Date: Sat, 12 Oct 2024 14:37:34 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> Date: Fri, 04 Oct 2024 16:36:24 +0200
> From:  Manuel Giraud via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <[email-masked]>
> 
> Same patch with a shorter version of image--update-properties.

Thanks, installed on the master branch, and closing the bug.

Subject: [PATCH] Correctly update image properties
From: Manuel Giraud <[email-masked]>
To: [email-masked]
Date: Thu, 03 Oct 2024 16:58:49 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Tags: patch

Hi,

Here is a patch that fixes how image's properties are updated.  You
could reproduce this issue as follow:

      - emacs -Q
      - C-x C-f etc/images/kitchen-sink.xpm <RET>
      - s s 8 <RET>
      - s m none <RET>  ;; -> the image is still smoothed

With this patch, the smoothing is updated accordingly.

In GNU Emacs 31.0.50 (build 9, x86_64-unknown-openbsd7.6, X toolkit) of
 2024-10-02 built on computer
Repository revision: 4bb62af3263057312021e076dc7e0c8ff195e38f
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101013
System Description: OpenBSD computer 7.6 GENERIC.MP#344 amd64

Configured using:
 'configure CC=egcc CPPFLAGS=-I/usr/local/include
 LDFLAGS=-L/usr/local/lib MAKEINFO=gmakeinfo --prefix=/home/manuel/emacs
 --bindir=/home/manuel/bin --with-x-toolkit=lucid
 --with-toolkit-scroll-bars=no --without-cairo
 --without-compress-install'

>From b59964af3c646efa79749e8d072784741ce57ac0 Mon Sep 17 00:00:00 2001
From: Manuel Giraud <[email-masked]>
Date: Thu, 3 Oct 2024 16:20:19 +0200
Subject: [PATCH] Correctly update image properties

* lisp/image-mode.el (image--update-properties): New function to
update image properties.
(image-toggle-display-image): Use it.
---
 lisp/image-mode.el | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index 7cf7845e935..6ad4c382d5f 100644
--- a/lisp/image-mode.el
+++ b/lisp/image-mode.el
@@ -867,6 +867,16 @@ image--scale-within-limits-p
         (or (<= mw (* (car size) scale))
             (<= mh (* (cdr size) scale))))))
 
+(defun image--update-properties (image properties)
+  "Update IMAGE with the new PROPERTIES set."
+  (let ((image-properties (cdr image))
+        prop val)
+    (while (setq prop (car properties))
+      (setq val (cadr properties)
+            properties (cddr properties))
+      (plist-put image-properties prop val))
+    (cons (car image) image-properties)))
+
 (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 +969,7 @@ image-toggle-display-image
 
     ;; 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
-- 
2.46.1

-- 
Manuel Giraud