]> git.eshelyaron.com Git - emacs.git/commitdiff
Make #anchors work again in eww
authorLars Ingebrigtsen <larsi@gnus.org>
Fri, 13 Apr 2018 12:55:55 +0000 (14:55 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Fri, 13 Apr 2018 12:55:55 +0000 (14:55 +0200)
* lisp/net/eww.el (eww-render): When we have a #link link, then
url.el will say that we have a redirect to a non-#link link, so
get the anchor before url.el mangles the URL (bug#28441).
(eww-display-html): ... and don't get it here, because it's gone
by now.

Test URL: http://www.gnu.org/s/hyperbole/#summary

lisp/net/eww.el

index 08a40cef182154be6dd23a081f5a88c280352af5..6b7fa05ded53d9e6ba7362136c04be8a3ad5d832 100644 (file)
@@ -349,9 +349,6 @@ Currently this means either text/html or application/xhtml+xml."
                         "application/xhtml+xml")))
 
 (defun eww-render (status url &optional point buffer encode)
-  (let ((redirect (plist-get status :redirect)))
-    (when redirect
-      (setq url redirect)))
   (let* ((headers (eww-parse-headers))
         (content-type
          (mail-header-parse-content-type
@@ -364,7 +361,11 @@ Currently this means either text/html or application/xhtml+xml."
                        (eww-detect-charset (eww-html-p (car content-type)))
                        "utf-8"))))
         (data-buffer (current-buffer))
+        (shr-target-id (url-target (url-generic-parse-url url)))
         last-coding-system-used)
+    (let ((redirect (plist-get status :redirect)))
+      (when redirect
+        (setq url redirect)))
     (with-current-buffer buffer
       ;; Save the https peer status.
       (plist-put eww-data :peer (plist-get status :peer))
@@ -460,7 +461,6 @@ Currently this means either text/html or application/xhtml+xml."
       (plist-put eww-data :dom document)
       (let ((inhibit-read-only t)
            (inhibit-modification-hooks t)
-           (shr-target-id (url-target (url-generic-parse-url url)))
            (shr-external-rendering-functions
              (append
               shr-external-rendering-functions