From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: George Huebner Newsgroups: gmane.emacs.bugs Subject: bug#71913: 29.1; shr: shr-resize-image does not behave as expected Date: Wed, 03 Jul 2024 01:37:52 -0500 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29343"; mail-complaints-to="usenet@ciao.gmane.io" To: 71913@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jul 03 09:37:14 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 1sOuYE-0007QS-PL for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 03 Jul 2024 09:37:14 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOuY5-0001ih-LV; Wed, 03 Jul 2024 03:37:05 -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 1sOuY1-0001hJ-K1 for bug-gnu-emacs@gnu.org; Wed, 03 Jul 2024 03:37:02 -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 1sOuY1-0000qC-9B for bug-gnu-emacs@gnu.org; Wed, 03 Jul 2024 03:37:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sOuY2-0002JF-R4 for bug-gnu-emacs@gnu.org; Wed, 03 Jul 2024 03:37:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: George Huebner Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 03 Jul 2024 07:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 71913 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.17199921988823 (code B ref -1); Wed, 03 Jul 2024 07:37:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 3 Jul 2024 07:36:38 +0000 Original-Received: from localhost ([127.0.0.1]:38531 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sOuXc-0002I9-RG for submit@debbugs.gnu.org; Wed, 03 Jul 2024 03:36:37 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:55030) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sOtcx-0000n2-Au for submit@debbugs.gnu.org; Wed, 03 Jul 2024 02:38:04 -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 1sOtcv-0005v6-2c for bug-gnu-emacs@gnu.org; Wed, 03 Jul 2024 02:38:01 -0400 Original-Received: from mail-il1-f181.google.com ([209.85.166.181]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sOtcs-0006I1-9t for bug-gnu-emacs@gnu.org; Wed, 03 Jul 2024 02:38:00 -0400 Original-Received: by mail-il1-f181.google.com with SMTP id e9e14a558f8ab-375af3538f2so23754945ab.3 for ; Tue, 02 Jul 2024 23:37:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719988676; x=1720593476; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=pk+PX4Md0NNmxDOGYDSaZ8RhXaIvkY9RZa0DRFbLYYE=; b=LIsrTruxBLhvBBysozMBk2NcWmBF4KZ0BcCS+wWIGc+Ik7ll3eoc0rc0XxocoO09Mx +V2wuFhQEfZ4G1o5ulEbh0tg6DyCKS9nuJvSsAab5St3JjjGw5lv5sTyJfO3zdGYrbPz BEMfEsytMhqKty+fyi5O/qB2UBQkecdclRHHU2Xj2PG9FVgTjbnz9Q0yCbQkIqAo8V3q F09ckXzw6E2guvEYH8k7SEqLvd1ZQSuP0AEDMhMVp0jNzHNOa27IC1W+/MOOfL0hLdIK Rp34koty+Oyd1vTCO9ZanH3D2ngGvBvcYYs116rCARXHP3Se/JIRBXFRtFlRyK6bNg/g 02HA== X-Gm-Message-State: AOJu0Yy/IEtVJQRNZTEeY7KUuGz/nbOwSqZqTk2CR1uBhnl/D73zmerW 2F1CFgpqMwkHyD9qXXY5Ya6ClW8+8twGoRcLRXJGS4gqLhrpaaimmRldlg== X-Google-Smtp-Source: AGHT+IFWaImq+l0z/lP3kWYEa5KqKPPuVxE2atZrRLm4cH4SvaJ5hWzqoFRlzjNQ8D2DE7uqNtAjOw== X-Received: by 2002:a05:6e02:20c9:b0:380:f340:ad66 with SMTP id e9e14a558f8ab-380f34ffb7fmr30671175ab.26.1719988675637; Tue, 02 Jul 2024 23:37:55 -0700 (PDT) Original-Received: from localhost (s-29-93.flex.volo.net. [76.191.29.93]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3826c45308esm817755ab.83.2024.07.02.23.37.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 23:37:55 -0700 (PDT) Received-SPF: pass client-ip=209.85.166.181; envelope-from=ghubs25@gmail.com; helo=mail-il1-f181.google.com X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 03 Jul 2024 03:36:33 -0400 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:288309 Archived-At: I noticed an issue with =shr-max-image-proportion= wherein images would be correctly resized on initial load, but would then appear much larger. I suspected this was an issue with caching, and sure enough, either disabling the cache with ~(setq shr-ignore-cache t)~ or manually deleting images from the cache results in images displaying correctly. This unanswered [[https://www.reddit.com/r/emacs/comments/esa3x5/image_scaling_in_elfeed_entry_window/][Reddit post]] seems to corroborate this behaviour. It looks like it might be because of the codepath taken in ~shr-tag-img~ wherein a cache miss results in the creation of a placeholder image; I had some trouble with edebug though, so that's just an educated guess. Here's a minimal reproducible example (credit to Sacha Chua): #+begin_src elisp :eval no ;; run this (image is very large), run again many times without killing *test* (image is correct size), kill *test* and run again (image is large again) ;; won't observe this behaviour if you disable cache ;; (setq shr-ignore-cache t) (setq shr-max-image-proportion 0.5) (with-current-buffer (get-buffer-create "*test*") (erase-buffer) (insert "") (shr-insert-document (libxml-parse-html-region (point-min) (point-max))) (display-buffer (current-buffer))) #+end_src elisp I also observed this behaviour on Emacs master (667ca66), but I daily drive 29.1. In GNU Emacs 29.1 (build 1, aarch64-apple-darwin23.4.0, Carbon Version 170 AppKit 2487.5) Windowing system distributor 'Apple Inc.', version 14.4.0 System Description: macOS 14.4 Configured using: 'configure --prefix=/nix/store/ismv7jzf3hcqziq5bpjfs54zd4qfjjn7-emacs-mac-macport-29.1 --disable-build-details --with-modules --without-gif --without-jpeg --without-png --without-tiff --without-x --without-xpm '--enable-mac-app=$$out/Applications' --with-gnutls --with-mac --with-xml2 --without-ns --with-compress-install --with-toolkit-scroll-bars --with-native-compilation --without-imagemagick --with-mailutils --without-small-ja-dic --with-tree-sitter --without-xinput2 --without-xwidgets --without-dbus --without-selinux --with-xwidgets'