From a0e6e67ac16b1d73e50b2af014a8319e2afe76a2 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sat, 22 Jan 2022 13:14:36 +0100 Subject: [PATCH] Fix HTML target marking in shr * lisp/net/shr.el (shr-descend): Use a marker (because we may be altering the text later for indentation), and mark the start, not the end of the tag (bug#53409). (shr-tag-a): Ditto. --- lisp/net/shr.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/net/shr.el b/lisp/net/shr.el index ff14acfda70..6e0af06bed1 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -630,7 +630,7 @@ size, and full-buffer size." (t (shr-generic dom))) (when-let ((id (dom-attr dom 'id))) - (push (cons id (point)) shr--link-targets)) + (push (cons id (set-marker (make-marker) start)) shr--link-targets)) ;; If style is set, then this node has set the color. (when style (shr-colorize-region @@ -1465,7 +1465,7 @@ ones, in case fg and bg are nil." (shr-generic dom) (when-let* ((id (and (not (dom-attr dom 'id)) ; Handled by `shr-descend'. (dom-attr dom 'name)))) ; Obsolete since HTML5. - (push (cons id (point)) shr--link-targets)) + (push (cons id (set-marker (make-marker) start)) shr--link-targets)) (when url (shr-urlify (or shr-start start) (shr-expand-url url) title) ;; Check whether the URL is suspicious. -- 2.39.5