GNU bug report logs - #56704
28.1.90; shr: The DOM is lost in the rendered result

Previous Next

Package: emacs;

Reported by: Damien Cassou <damien <at> cassou.me>

Date: Fri, 22 Jul 2022 15:18:01 UTC

Severity: normal

Tags: wontfix

Found in version 28.1.90

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 56704 in the body.
You can then email your comments to 56704 AT debbugs.gnu.org in the normal way.

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#56704; Package emacs. (Fri, 22 Jul 2022 15:18:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Damien Cassou <damien <at> cassou.me>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 22 Jul 2022 15:18:01 GMT) Full text and rfc822 format available.

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

From: Damien Cassou <damien <at> cassou.me>
To: bug-gnu-emacs <at> gnu.org
Cc: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Subject: 28.1.90; shr: The DOM is lost in the rendered result
Date: Fri, 22 Jul 2022 17:16:40 +0200
Hi,

SHR doesn't link the text being inserted in the buffer and DOM node
being rendered. This means it is not possible to implement some use
cases, e.g.,

- inspect/copy the DOM node rendered at point;

- share/bookmark a link to a particular section of a page (which
  requires knowing the id attribute of the enclosing DOM node).

I fixed this by changing shr-generic from:

(defsubst shr-generic (dom)
  (dolist (sub (dom-children dom))
    (if (stringp sub)
	(shr-insert sub)
      (shr-descend sub))))

to

(defsubst shr-generic (dom)
  (let ((start (point)))
    (dolist (sub (dom-children dom))
      (if (stringp sub)
	  (shr-insert sub)
        (shr-descend sub)))
    (unless (eq start (point-max))
      (put-text-property start (1+ start) 'shr-dom dom))))


This seems to work great.

Is this change desirable? Do you want a patch?

-- 
Damien Cassou

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56704; Package emacs. (Sat, 23 Jul 2022 05:55:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Damien Cassou <damien <at> cassou.me>
Cc: 56704 <at> debbugs.gnu.org
Subject: Re: bug#56704: 28.1.90; shr: The DOM is lost in the rendered result
Date: Sat, 23 Jul 2022 07:54:41 +0200
Damien Cassou <damien <at> cassou.me> writes:

> SHR doesn't link the text being inserted in the buffer and DOM node
> being rendered.

Yes, shr is already slow enough, so basically all "debugging"-like
things were eschewed.  It'd be nice to have, but if shr is unusably
slow, that's not nice, either.

So we won't be adding something like this, and I'm therefore closing
this bug report.






Added tag(s) wontfix. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 23 Jul 2022 05:56:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 56704 <at> debbugs.gnu.org and Damien Cassou <damien <at> cassou.me> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 23 Jul 2022 05:56:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 20 Aug 2022 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years ago.

Previous Next


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