From: Lars Magne Ingebrigtsen Date: Mon, 16 Dec 2013 23:40:17 +0000 (+0100) Subject: * net/shr.el (shr-tag-a): Support zero-length elements. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~377 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1c4b1e6107d17a184416b9bffd97222c06e5ff83;p=emacs.git * net/shr.el (shr-tag-a): Support zero-length elements. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8c196343e7e..d267715bee3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2013-12-16 Lars Magne Ingebrigtsen + * net/shr.el (shr-tag-a): Support zero-length elements. + * net/eww.el (eww-display-html): If we can't find the anchor we're looking for, then go to point-min. diff --git a/lisp/net/eww.el b/lisp/net/eww.el index afcd2ecb391..a4cec26dbf9 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -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 diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 4c256f8d716..34672b28191 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -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 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))))