unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#71913: 29.1; shr: shr-resize-image does not behave as expected
@ 2024-07-03  6:37 George Huebner
  2024-07-03 15:48 ` Jim Porter
  0 siblings, 1 reply; 11+ messages in thread
From: George Huebner @ 2024-07-03  6:37 UTC (permalink / raw)
  To: 71913

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 "<img 
  src=\"https://upload.wikimedia.org/wikipedia/commons/8/83/The_GNU_logo.png\">")
  (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'





^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-07-13 18:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-03  6:37 bug#71913: 29.1; shr: shr-resize-image does not behave as expected George Huebner
2024-07-03 15:48 ` Jim Porter
     [not found]   ` <m25xtmz0fj.fsf@feyor.sh>
2024-07-05 18:11     ` Jim Porter
2024-07-10 19:02       ` George Huebner
2024-07-11 23:51         ` Jim Porter
2024-07-12  5:58           ` Eli Zaretskii
2024-07-13  4:11             ` Jim Porter
2024-07-13  6:20               ` Eli Zaretskii
2024-07-13 17:29                 ` Jim Porter
2024-07-13 17:39                   ` Eli Zaretskii
2024-07-13 18:54                     ` Jim Porter

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).