From 776705f49c5cb4e66c7dcb316fe499aa6a183888 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Mon, 26 Jan 2015 16:35:51 +1100 Subject: [PATCH] (shr-make-table-1): Add comments. --- lisp/ChangeLog | 1 + lisp/net/shr.el | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8af0ec46cad..1bb003c9205 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,6 +1,7 @@ 2015-01-26 Lars Ingebrigtsen * net/shr.el (shr-make-table-1): Fix colspan typo. + (shr-make-table-1): Add comments. * net/eww.el (eww-add-bookmark): Fix prompt and clean up the code slightly. diff --git a/lisp/net/shr.el b/lisp/net/shr.el index a0c9eba4144..f4c765f4d25 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -1667,11 +1667,17 @@ The preference is a float determined from `shr-prefer-media-type'." ;; remaining columns. (- (length widths) i))) (dotimes (j (1- colspan)) - (if (> (+ i 1 j) (1- (length widths))) - (setq width (aref widths (1- (length widths)))) - (setq width (+ width - shr-table-separator-length - (aref widths (+ i 1 j)))))) + (setq width + (if (> (+ i 1 j) (1- (length widths))) + ;; If we have a colspan spec that's longer + ;; than the table is wide, just use the last + ;; width as the width. + (aref widths (1- (length widths))) + ;; Sum up the widths of the columns we're + ;; spanning. + (+ width + shr-table-separator-length + (aref widths (+ i 1 j)))))) (setq width-column (+ width-column (1- colspan)))) (when (or column (not fill)) -- 2.39.5