]> code.delx.au - gnu-emacs/commitdiff
* net/shr.el (shr-tag-a): Support zero-length <a name="foo"> elements.
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Mon, 16 Dec 2013 23:40:17 +0000 (00:40 +0100)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Mon, 16 Dec 2013 23:40:17 +0000 (00:40 +0100)
lisp/ChangeLog
lisp/net/eww.el
lisp/net/shr.el

index 8c196343e7e20ec3047cdda21a687a6e2c9f9c0d..d267715bee35202630e4e66237e7987dc82bccda 100644 (file)
@@ -1,5 +1,7 @@
 2013-12-16  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * net/shr.el (shr-tag-a): Support zero-length <a name="foo"> elements.
+
        * net/eww.el (eww-display-html): If we can't find the anchor we're
        looking for, then go to point-min.
 
index afcd2ecb39192fafefb8e72bb3b3a3dced3a5e75..a4cec26dbf91e90bb35b3a8800bd8ba8bc206f72 100644 (file)
@@ -269,11 +269,11 @@ word(s) will be searched for via `eww-search-prefix'."
        (point
        (goto-char point))
        (shr-target-id
+       (goto-char (point-min))
        (let ((point (next-single-property-change
                      (point-min) 'shr-target-id)))
-         (goto-char (if point
-                        (1+ point)
-                      (point-min)))))
+         (when point
+           (goto-char point))))
        (t
        (goto-char (point-min)))))
     (setq eww-current-url url
index 4c256f8d716ee625f237fcc701bc3ca348dad9ec..34672b281916837e62dcb506685f059171ca5b44 100644 (file)
@@ -1078,6 +1078,14 @@ ones, in case fg and bg are nil."
        (start (point))
        shr-start)
     (shr-generic cont)
+    (when (and shr-target-id
+              (equal (cdr (assq :name (cdr dom))) shr-target-id))
+      ;; We have a zero-length <a name="foo"> element, so just
+      ;; insert...  something.
+      (when (= start (point))
+       (shr-ensure-newline)
+       (insert " "))
+      (put-text-property start (1+ start) 'shr-target-id shr-target-id))
     (when (and url
               (not shr-inhibit-decoration))
       (shr-urlify (or shr-start start) (shr-expand-url url) title))))