GNU bug report logs -
#71913
29.1; shr: shr-resize-image does not behave as expected
Previous Next
Reported by: George Huebner <george <at> feyor.sh>
Date: Wed, 3 Jul 2024 07:37:02 UTC
Severity: normal
Found in version 29.1
Done: Jim Porter <jporterbugs <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On 7/2/2024 11:37 PM, George Huebner wrote:
> I noticed an issue with =shr-max-image-proportion= wherein images would
> be correctly resized on initial load, but would then appear much larger.
[snip]
> 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
The bug here is really in your steps to reproduce, which I suppose is
roughly what Elfeed is doing too (though I haven't looked at that code
to be totally sure).
SHR scales images with respect to the size of the buffer's window.
However, by rendering the HTML document with SHR *before* displaying the
buffer in a window, it's impossible for Emacs to do that: there's no
such window yet! If you swap the 'display-buffer' and
'shr-insert-document' lines though, all should work properly.
This bug report was last modified 1 year and 8 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.