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 #11 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>, Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 40532 <at> debbugs.gnu.org
Subject: Re: bug#40532: 28.0.50; eww/shr: Anchor link does not work
Date: Wed, 22 Apr 2020 12:38:17 +0100
[Message part 1 (text/plain, inline)]
found 40532 27.0.50
tags 40532 + patch
quit

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

> I have  investigated a little  and it  seems to be  because of a  bug in
> eww-follow-link (bound to RET key).

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.

> It goes to the anchor link by clicking on it (<mouse-2>) or with 'v' key
> as it  actually calls  shr-browse-url (but this  has the  side-effect of
> reloading the whole page though).

Yes, we wouldn't want eww-follow-link to do that, and in fact it already
contains logic to avoid reloading the whole page, modulo the
aforementioned regression in Emacs 27.

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

[0001-Fix-following-target-on-same-page-in-EWW.patch (text/x-diff, inline)]
From 213264081a827e9041dbab294a5ff72fdc71b45f 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 following target on same page in EWW

* lisp/net/eww.el (eww-follow-link): Set shr-target-id before
calling eww-display-html as the latter no longer does so for
us (bug#28441, bug#40532).
---
 lisp/net/eww.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index c83884fd25..8bbbcae9c2 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -1578,7 +1578,8 @@ eww-follow-link
      ;; This is a #target url in the same page as the current one.
      ((and (url-target (url-generic-parse-url url))
 	   (eww-same-page-p url (plist-get eww-data :url)))
-      (let ((dom (plist-get eww-data :dom)))
+      (let ((dom (plist-get eww-data :dom))
+            (shr-target-id (url-target (url-generic-parse-url url))))
 	(eww-save-history)
 	(plist-put eww-data :url url)
 	(eww-display-html 'utf-8 url dom nil (current-buffer))))
-- 
2.26.1

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

-- 
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.