From: Jim Porter Date: Sat, 21 Jun 2025 19:10:59 +0000 (-0700) Subject: When navigating to anchor targets in EWW, retain 'eww-data' properties X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a53fcc23757fb1aa9b86cdc2a878d4ac689bb015;p=emacs.git When navigating to anchor targets in EWW, retain 'eww-data' properties Previously, navigating to an in-page anchor target would clear 'eww-data', removing many important properties like the original source and the DOM. Among other things, this prevented enabling/disabling readable mode. * lisp/net/eww.el (eww-follow-link): Copy previous 'eww-data'. (cherry picked from commit e5ad9ae10090ab34a4d71139e6f928c11f0c029c) --- diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 34f58fd89f0..c848af1cac4 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -2176,9 +2176,13 @@ EXTERNAL is the prefix argument. If called interactively with ;; This is a #target url in the same page as the current one. ((and (setq target (url-target (url-generic-parse-url url))) (eww-same-page-p url (plist-get eww-data :url))) - (let ((point (point))) + (let ((old-data eww-data) + (point (point))) (eww-save-history) (eww--before-browse) + ;; Copy previous `eww-data', since everything but the URL will + ;; stay the same, and we don't re-render the document. + (setq eww-data (copy-sequence old-data)) (plist-put eww-data :url url) (goto-char (point-min)) (if-let ((match (text-property-search-forward 'shr-target-id target #'member)))