GNU bug report logs - #40532
28.0.50; eww/shr: Anchor link does not work

Previous Next

Package: emacs;

Reported by: Arnaud Fontaine <arnau <at> mini-dweeb.org>

Date: Fri, 10 Apr 2020 04:38:02 UTC

Severity: normal

Tags: fixed, patch

Found in versions 28.0.50, 27.0.50

Fixed in version 28.1

Done: "Basil L. Contovounesios" <contovob <at> tcd.ie>

Bug is archived. No further changes may be made.

Full log


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

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Arnaud Fontaine <arnau <at> mini-dweeb.org>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 40532 <at> debbugs.gnu.org
Subject: Re: bug#40532: 28.0.50; eww/shr: Anchor link does not work
Date: Wed, 22 Apr 2020 13:55:05 +0100
[Message part 1 (text/plain, inline)]
"Basil L. Contovounesios" <contovob <at> tcd.ie> writes:

> Indeed; I think it's a regression in Emacs 27 caused by the following
> fix for bug#28441:
>
> Make #anchors work again in eww
> fa41693799 2018-04-13 14:55:55 +0200
> https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=fa416937997a113d84ab4e4910d730ce5d77613d
>
> Previously, eww-follow-link depended on eww-display-html to set
> shr-target-id, but following this change that's no longer the case.
>
> This doesn't affect eww-reload, which also calls eww-display-html,
> because it passes it an explicit position to jump to.

[...]

> Lars, Eli, how's the following fix for emacs-27?

Here's an even better fix for the regression IMO:

[0001-Fix-eww-follow-link-on-URLs-with-target.patch (text/x-diff, inline)]
From 541a85fd17193a67883a36876fb982710abe4f7d Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Date: Wed, 22 Apr 2020 11:42:17 +0100
Subject: [PATCH] Fix eww-follow-link on URLs with #target

* lisp/net/eww.el (eww-display-html): Ensure shr-target-id is set as
callers depend on this (bug#28441, bug#40532).
---
 lisp/net/eww.el | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index c83884fd25..1be499172b 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -518,6 +518,10 @@ eww-display-html
       (plist-put eww-data :dom document)
       (let ((inhibit-read-only t)
 	    (inhibit-modification-hooks t)
+            ;; Possibly set by the caller, e.g., `eww-render' which
+            ;; preserves the old URL #target before chasing redirects.
+            (shr-target-id (or shr-target-id
+                               (url-target (url-generic-parse-url url))))
 	    (shr-external-rendering-functions
              (append
               shr-external-rendering-functions
-- 
2.26.1

[Message part 3 (text/plain, inline)]
WDYT?

-- 
Basil

This bug report was last modified 5 years and 34 days ago.

Previous Next


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