From 0d7d12ffe6114c500cd1f183e9a2c74ba1974093 Mon Sep 17 00:00:00 2001 From: Thomas Plass Date: Mon, 10 Jun 2019 13:36:46 +0200 Subject: [PATCH] ox: Make `org-export-table-cell-alignment' more robust * lisp/ox.el (org-export-table-cell-alignment): Make `org-export-table-cell-alignment' handle tables with rows containing unequal numbers of cells. Patch modeled after previous fix for `org-export-table-cell-width'. TINYCHANGE --- lisp/ox.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lisp/ox.el b/lisp/ox.el index f7b01daa4..26fbfdaad 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -4917,7 +4917,7 @@ same column as TABLE-CELL, or nil." table))) (width-vector (or (gethash table cache) (puthash table (make-vector columns 'empty) cache)))) - ;; Table may not have the same number of rows. Extend + ;; Table rows may not have the same number of cells. Extend ;; WIDTH-VECTOR appropriately if we encounter a row larger than ;; expected. (when (>= column (length width-vector)) @@ -4966,6 +4966,15 @@ Possible values are `left', `right' and `center'." table))) (align-vector (or (gethash table cache) (puthash table (make-vector columns nil) cache)))) + ;; Table rows may not have the same number of cells. Extend + ;; ALIGN-VECTOR appropriately if we encounter a row larger than + ;; expected. + (when (>= column (length align-vector)) + (setq align-vector + (vconcat align-vector + (make-list (- (1+ column) (length align-vector)) + nil))) + (puthash table align-vector cache)) (or (aref align-vector column) (let ((number-cells 0) (total-cells 0)