]> code.delx.au - gnu-emacs/blobdiff - lisp/net/shr.el
-
[gnu-emacs] / lisp / net / shr.el
index 0effa93b197ff7ea0fe7fe3d706d238ad67d7bca..290a6422bd77ba2237c13425090a7e0d1041a6dd 100644 (file)
@@ -1,6 +1,6 @@
 ;;; shr.el --- Simple HTML Renderer
 
-;; Copyright (C) 2010-2015 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2016 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: html
@@ -259,6 +259,11 @@ DOM should be a parse tree as generated by
                                          (* (frame-char-width) 2)
                                        0)))))
         bidi-display-reordering)
+    ;; If the window was hscrolled for some reason, shr-fill-lines
+    ;; below will misbehave, because it silently assumes that it
+    ;; starts with a non-hscrolled window (vertical-motion will move
+    ;; to a wrong place otherwise).
+    (set-window-hscroll nil 0)
     (shr-descend dom)
     (shr-fill-lines start (point))
     (shr-remove-trailing-whitespace start (point))
@@ -1373,7 +1378,7 @@ The preference is a float determined from `shr-prefer-media-type'."
         (start (point)))
     (unless url
       (setq url (car (shr--extract-best-source dom))))
-    (if image
+    (if (> (length image) 0)
         (shr-tag-img nil image)
       (shr-insert " [video] "))
     (shr-urlify start (shr-expand-url url))))
@@ -1612,7 +1617,9 @@ The preference is a float determined from `shr-prefer-media-type'."
     (shr-insert-table (shr-make-table dom sketch-widths t) sketch-widths)))
 
 (defun shr-table-body (dom)
-  (let ((tbodies (dom-by-tag dom 'tbody)))
+  (let ((tbodies (seq-filter (lambda (child)
+                               (eq (dom-tag child) 'tbody))
+                             (dom-children dom))))
     (cond
      ((null tbodies)
       dom)