]> code.delx.au - gnu-emacs/blobdiff - lisp/net/shr.el
Fix some custom types
[gnu-emacs] / lisp / net / shr.el
index 89791511e093d91d96aefa39a54cb302bcbac6f8..bc4542923607f41ce9c4f7ec35ba2e95af8909ba 100644 (file)
@@ -59,7 +59,7 @@ fit these criteria."
   "Character used to draw horizontal table lines.
 If nil, don't draw horizontal table lines."
   :group 'shr
-  :type 'character)
+  :type '(choice (const nil) character))
 
 (defcustom shr-table-vertical-line ?\s
   "Character used to draw vertical table lines."
@@ -1488,7 +1488,11 @@ ones, in case fg and bg are nil."
                      10))
              (when (and fill
                         (setq colspan (cdr (assq :colspan (cdr column)))))
-               (setq colspan (string-to-number colspan))
+               (setq colspan (min (string-to-number colspan)
+                                  ;; The colspan may be wrong, so
+                                  ;; truncate it to the length of the
+                                  ;; remaining columns.
+                                  (- (length widths) i)))
                (dotimes (j (1- colspan))
                  (if (> (+ i 1 j) (1- (length widths)))
                      (setq width (aref widths (1- (length widths))))
@@ -1498,9 +1502,6 @@ ones, in case fg and bg are nil."
                (setq width-column (+ width-column (1- colspan))))
              (when (or column
                        (not fill))
-               ;; Sanity check for degenerate tables.
-               (when (zerop width)
-                 (setq width 10))
                (push (shr-render-td (cdr column) width fill)
                      tds))
              (setq i (1+ i)
@@ -1509,7 +1510,6 @@ ones, in case fg and bg are nil."
     (nreverse trs)))
 
 (defun shr-render-td (cont width fill)
-  (when (= width 0) (debug))
   (with-temp-buffer
     (let ((bgcolor (cdr (assq :bgcolor cont)))
          (fgcolor (cdr (assq :fgcolor cont)))