unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Visuwesh <visuweshm@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 67764@debbugs.gnu.org, jm@pub.pink
Subject: bug#67764: 30.0.50; Opening image in eww no longer works
Date: Tue, 12 Dec 2023 09:42:54 +0530	[thread overview]
Message-ID: <87r0jst5x5.fsf@gmail.com> (raw)
In-Reply-To: <83edfsvj0a.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 11 Dec 2023 17:47:17 +0200")

[-- Attachment #1: Type: text/plain, Size: 956 bytes --]

[Monday December 11, 2023] Eli Zaretskii wrote:

>> Cc: 67764@debbugs.gnu.org
>> From: Visuwesh <visuweshm@gmail.com>
>> Date: Mon, 11 Dec 2023 17:10:01 +0530
>> 
>> >   emacs -Q
>> >   M-: (eww "https://www.gnu.org/software/emacs/images/emacs.png")
>> >
>> > On master it fails with "Wrong type argument: stringp, nil".
>> > Bisect says 4254544 is the first bad commit.
>> 
>> Recent changes in shr-put-image didn't account for the possible nil
>> value for ALT.  Attached patch fixes the issue on my end.
>> 
>> 
>> >From f6d3fc0de572a1039e83df0389c1c7efce0ef0cf Mon Sep 17 00:00:00 2001
>> From: Visuwesh <visuweshm@gmail.com>
>> Date: Mon, 11 Dec 2023 17:09:03 +0530
>> Subject: [PATCH] ; Fix shr-put-image with nil value for ALT
>> 
>> [...]
>>
> Thanks, but can we please avoid running a fixed string through
> string-trim?
>
> Also, I think the fallback on "*" deserves a comment to explain why
> that is done.

OK, how about the attached instead?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-shr-put-image-with-nil-value-for-ALT.patch --]
[-- Type: text/x-diff, Size: 977 bytes --]

From 27cd2c4c028723009ebf19696825d22c15f59795 Mon Sep 17 00:00:00 2001
From: Visuwesh <visuweshm@gmail.com>
Date: Mon, 11 Dec 2023 17:09:03 +0530
Subject: [PATCH] Fix shr-put-image with nil value for ALT

* lisp/net/shr.el (shr-put-image): Account for nil value for ALT.
(Bug#6774)
---
 lisp/net/shr.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 9f030b4c743..bf5038a421d 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -1137,7 +1137,9 @@ shr-put-image
         (when image
           ;; The trailing space can confuse shr-insert into not
           ;; putting any space after inline images.
-	  (setq alt (string-trim alt))
+          ;; ALT may be nil when visiting image URLs in eww
+          ;; (bug#6774).
+	  (setq alt (if alt (string-trim alt) "*"))
 	  ;; When inserting big-ish pictures, put them at the
 	  ;; beginning of the line.
 	  (let ((inline (shr--inline-image-p image)))
-- 
2.42.0


  reply	other threads:[~2023-12-12  4:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-11  6:26 bug#67764: 30.0.50; Opening image in eww no longer works john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-11 11:40 ` Visuwesh
2023-12-11 15:03   ` john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-11 15:47   ` Eli Zaretskii
2023-12-12  4:12     ` Visuwesh [this message]
2023-12-12  8:14       ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-12  9:14         ` Visuwesh
2023-12-16 12:53           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r0jst5x5.fsf@gmail.com \
    --to=visuweshm@gmail.com \
    --cc=67764@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=jm@pub.pink \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).