GNU bug report logs - #66457
30.0.50; shr sometimes displays the same image twice

Previous Next

Package: emacs;

Reported by: Katsumi Yamaoka <yamaoka <at> jpl.org>

Date: Wed, 11 Oct 2023 00:27:01 UTC

Severity: normal

Found in version 30.0.50

To reply to this bug, email your comments to 66457 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#66457; Package emacs. (Wed, 11 Oct 2023 00:27:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Katsumi Yamaoka <yamaoka <at> jpl.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 11 Oct 2023 00:27:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Katsumi Yamaoka <yamaoka <at> jpl.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; shr sometimes displays the same image twice
Date: Wed, 11 Oct 2023 09:25:39 +0900
[Message part 1 (text/plain, inline)]
Hi,

If an alt text, that has an `image-displayer' text property, is
filled by `shr-fill-line' by way of `shr-fill-lines', the image
is displayed for two or more times.  It is because the
`image-displayer' text property is divided by the newline(s).
Here is a quick hack:

[Message part 2 (text/x-patch, inline)]
--- lisp/net/shr.el~	2023-09-04 23:25:12.472173300 +0000
+++ lisp/net/shr.el	2023-10-11 00:23:43.577152000 +0000
@@ -799,13 +799,17 @@
         (when (= (preceding-char) ?\s)
 	  (delete-char -1))
         (let ((gap-start (point))
-              (face (get-text-property (point) 'face)))
-          ;; Extend the background to the end of the line.
+              (face (get-text-property (point) 'face))
+              (displayer (get-text-property (point) 'image-displayer)))
+          ;; Extend the background and the image displayer to the end
+          ;; of the line.
           (insert ?\n)
 	  (shr-indent)
           (when face
             (put-text-property gap-start (point)
                                'face (shr-face-background face)))
+          (when displayer
+            (put-text-property gap-start (point) 'image-displayer displayer))
           (when (and (> (1- gap-start) (point-min))
                      (get-text-property (point) 'shr-url)
                      ;; The link on both sides of the newline are the

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66457; Package emacs. (Wed, 11 Oct 2023 12:05:01 GMT) Full text and rfc822 format available.

Message #8 received at 66457 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Katsumi Yamaoka <yamaoka <at> jpl.org>
Cc: 66457 <at> debbugs.gnu.org
Subject: Re: bug#66457: 30.0.50; shr sometimes displays the same image twice
Date: Wed, 11 Oct 2023 15:04:13 +0300
> Date: Wed, 11 Oct 2023 09:25:39 +0900
> From: Katsumi Yamaoka <yamaoka <at> jpl.org>
> 
> If an alt text, that has an `image-displayer' text property, is
> filled by `shr-fill-line' by way of `shr-fill-lines', the image
> is displayed for two or more times.  It is because the
> `image-displayer' text property is divided by the newline(s).
> Here is a quick hack:

Thanks, but can you show a recipe to reproduce the issue and test the
solution?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66457; Package emacs. (Thu, 12 Oct 2023 00:50:01 GMT) Full text and rfc822 format available.

Message #11 received at 66457 <at> debbugs.gnu.org (full text, mbox):

From: Katsumi Yamaoka <yamaoka <at> jpl.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 66457 <at> debbugs.gnu.org
Subject: Re: bug#66457: 30.0.50; shr sometimes displays the same image twice
Date: Thu, 12 Oct 2023 09:49:00 +0900
[Message part 1 (text/plain, inline)]
On Wed, 11 Oct 2023 15:04:13 +0300, Eli Zaretskii wrote:
> Thanks, but can you show a recipe to reproduce the issue and test the
> solution?

Ok, here is an example html mail.
Set `mm-text-html-renderer' to `shr', read the example mail in
Gnus in some way, and try `W D W' and `W D D' commands.
[Example (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66457; Package emacs. (Thu, 12 Oct 2023 05:10:02 GMT) Full text and rfc822 format available.

Message #14 received at 66457 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Katsumi Yamaoka <yamaoka <at> jpl.org>
Cc: 66457 <at> debbugs.gnu.org
Subject: Re: bug#66457: 30.0.50; shr sometimes displays the same image twice
Date: Thu, 12 Oct 2023 08:08:57 +0300
> Date: Thu, 12 Oct 2023 09:49:00 +0900
> From: Katsumi Yamaoka <yamaoka <at> jpl.org>
> Cc: 66457 <at> debbugs.gnu.org
> 
> On Wed, 11 Oct 2023 15:04:13 +0300, Eli Zaretskii wrote:
> > Thanks, but can you show a recipe to reproduce the issue and test the
> > solution?
> 
> Ok, here is an example html mail.
> Set `mm-text-html-renderer' to `shr', read the example mail in
> Gnus in some way, and try `W D W' and `W D D' commands.

Thanks.  (That was an invalid mbox file, btw; I needed to fix it, but
that was easy.  Also, I don't use Gnus, so if you can show a fill
recipe including the "read the example mail in Gnus in some way" part,
I'd appreciate that, as I'd like to make sure I see exactly what you
see in Gnus.  Meanwhile, I tried in Rmail instead, which also uses
shr.el to display HTML emails.)

So now I'm not sure I understand what you are saying.  You said:

> If an alt text, that has an `image-displayer' text property, is
> filled by `shr-fill-line' by way of `shr-fill-lines', the image
> is displayed for two or more times.  It is because the
> `image-displayer' text property is divided by the newline(s).

AFAIU, the alt text is text that is displayed instead of an image,
when the image cannot or should not be displayed for some reason.  If
my understanding is correct, then why do you expect the alt text to
take only one line on display?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66457; Package emacs. (Wed, 25 Oct 2023 13:48:02 GMT) Full text and rfc822 format available.

Message #17 received at 66457 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: yamaoka <at> jpl.org
Cc: 66457 <at> debbugs.gnu.org
Subject: Re: bug#66457: 30.0.50; shr sometimes displays the same image twice
Date: Wed, 25 Oct 2023 16:47:12 +0300
Ping!

> Cc: 66457 <at> debbugs.gnu.org
> Date: Thu, 12 Oct 2023 08:08:57 +0300
> From: Eli Zaretskii <eliz <at> gnu.org>
> 
> > Date: Thu, 12 Oct 2023 09:49:00 +0900
> > From: Katsumi Yamaoka <yamaoka <at> jpl.org>
> > Cc: 66457 <at> debbugs.gnu.org
> > 
> > On Wed, 11 Oct 2023 15:04:13 +0300, Eli Zaretskii wrote:
> > > Thanks, but can you show a recipe to reproduce the issue and test the
> > > solution?
> > 
> > Ok, here is an example html mail.
> > Set `mm-text-html-renderer' to `shr', read the example mail in
> > Gnus in some way, and try `W D W' and `W D D' commands.
> 
> Thanks.  (That was an invalid mbox file, btw; I needed to fix it, but
> that was easy.  Also, I don't use Gnus, so if you can show a fill
> recipe including the "read the example mail in Gnus in some way" part,
> I'd appreciate that, as I'd like to make sure I see exactly what you
> see in Gnus.  Meanwhile, I tried in Rmail instead, which also uses
> shr.el to display HTML emails.)
> 
> So now I'm not sure I understand what you are saying.  You said:
> 
> > If an alt text, that has an `image-displayer' text property, is
> > filled by `shr-fill-line' by way of `shr-fill-lines', the image
> > is displayed for two or more times.  It is because the
> > `image-displayer' text property is divided by the newline(s).
> 
> AFAIU, the alt text is text that is displayed instead of an image,
> when the image cannot or should not be displayed for some reason.  If
> my understanding is correct, then why do you expect the alt text to
> take only one line on display?
> 
> 
> 
> 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66457; Package emacs. (Wed, 25 Oct 2023 23:59:02 GMT) Full text and rfc822 format available.

Message #20 received at 66457 <at> debbugs.gnu.org (full text, mbox):

From: Katsumi Yamaoka <yamaoka <at> jpl.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 66457 <at> debbugs.gnu.org
Subject: Re: bug#66457: 30.0.50; shr sometimes displays the same image twice
Date: Thu, 26 Oct 2023 08:58:04 +0900
On Wed, 25 Oct 2023 16:47:12 +0300, Eli Zaretskii wrote:
> Ping!

[...]

>>> If an alt text, that has an `image-displayer' text property, is
>>> filled by `shr-fill-line' by way of `shr-fill-lines', the image
>>> is displayed for two or more times.  It is because the
>>> `image-displayer' text property is divided by the newline(s).

>> AFAIU, the alt text is text that is displayed instead of an image,
>> when the image cannot or should not be displayed for some reason.  If
>> my understanding is correct, then why do you expect the alt text to
>> take only one line on display?

Well, I don't think so, i.e., the alt text may be multiple lines.
However, the author wrote shr-fill-line so to assume it to take
a single line, or he only might have overlooked it.




This bug report was last modified 191 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.