From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#73617: [PATCH] Correctly update image properties Date: Thu, 03 Oct 2024 16:58:49 +0200 Message-ID: <87o741qlli.fsf@ledu-giraud.fr> Reply-To: Manuel Giraud Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26499"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: 73617@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 03 17:00:15 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1swNJO-0006kF-U9 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 03 Oct 2024 17:00:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1swNJD-00089N-18; Thu, 03 Oct 2024 11:00:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1swNJB-00088W-3X for bug-gnu-emacs@gnu.org; Thu, 03 Oct 2024 11:00:01 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swNJA-0004HS-Rn for bug-gnu-emacs@gnu.org; Thu, 03 Oct 2024 11:00:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=qP/84xuNXA8pvIscB8CZV1YlhF0R+BCYwQU53VRAhjU=; b=IPs28JNz9ncNKSDSqtcBBztxTwvtcMf/9FpZvmwp1AuYebAbHhAh/WZGRsu+kLxbpln+3Rge0boys1Yj9ytCQnTugQGoYAoD+/NKnUq0ipaZjyAcCgdEKkcHk47q48At2wddieOekNbeKF7hG385RAHIShu/wRQfoBiqq+rAKpGFSXnVxdLClgKIoty5y3UqOYrVXbFDX7F1G+tcK9/LRe30DH84GLSZ2srDCwp0nSqZCNWdkYu7Sb4tp9ewhtjXM9c24Jb20b5ebLVjIdiSbGHbBzOM3ORLJfcnVOBHF7RLiV3yler/FEkj47oVZUlKOs2T1U9ii6VbQ6BQ4KpyJA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1swNJC-0000af-LR for bug-gnu-emacs@gnu.org; Thu, 03 Oct 2024 11:00:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Manuel Giraud Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 03 Oct 2024 15:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 73617 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.17279675412145 (code B ref -1); Thu, 03 Oct 2024 15:00:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 3 Oct 2024 14:59:01 +0000 Original-Received: from localhost ([127.0.0.1]:33717 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swNID-0000YR-BE for submit@debbugs.gnu.org; Thu, 03 Oct 2024 10:59:01 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:34360) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swNIB-0000YE-Ia for submit@debbugs.gnu.org; Thu, 03 Oct 2024 10:59:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1swNI9-0007z8-0c for bug-gnu-emacs@gnu.org; Thu, 03 Oct 2024 10:58:57 -0400 Original-Received: from ledu-giraud.fr ([51.159.28.247]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1swNI6-0004By-T7 for bug-gnu-emacs@gnu.org; Thu, 03 Oct 2024 10:58:56 -0400 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=4B/HkM2r CKZDKha87PxtLg2gCJLIakT1pmRRPAubTTk=; h=date:subject:to:from; d=ledu-giraud.fr; b=6NRN01hMP3B7xXj14U6Gk+UBkx01iS97IqgqwTTdZJCYrYkQMo A2l/WF9BO/apz1Wnj48TdEhLlRiK2fbCzOAw== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=4B/HkM2rCKZDKha8 7PxtLg2gCJLIakT1pmRRPAubTTk=; h=date:subject:to:from; d=ledu-giraud.fr; b=zhB2Ccc5nv3JJdPF3BCgxv7ievM0Mqrylx+bPMztn/j+UxCzjR IObWMZQvcYm7tqABlZ+8Km4jg4LvoQOr9FNxG7WHyS79Z1yhA5dsfXIsKdBQsROTq6UYRZ rg166tx2+fARrzNEz0wfxbPq4cK9KfRoPTSaokiP9+DRpCN78zlaFKwMy+sm+/kuQEd8p+ falg+LrVcIjnh65AEdrOWI9DFKlTweqXdn5mMIw/F8Z4kvPuiswl+aQYnmFd5DZ2NDUsZE DwXYfgkyhyqC4caYb32veaJP0tt1EejpHQW5yJhoIE0JLbodgJKPLvivoHvlVi0C0vx7Du 4x8XbM12vttg== Original-Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id 4d3566bc (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Thu, 3 Oct 2024 16:58:50 +0200 (CEST) Received-SPF: pass client-ip=51.159.28.247; envelope-from=manuel@ledu-giraud.fr; helo=ledu-giraud.fr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:292911 Archived-At: --=-=-= Content-Type: text/plain 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 - s s 8 - s m none ;; -> 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' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Correctly-update-image-properties.patch >From b59964af3c646efa79749e8d072784741ce57ac0 Mon Sep 17 00:00:00 2001 From: Manuel Giraud 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 --=-=-= Content-Type: text/plain -- Manuel Giraud --=-=-=--