From 8c833ed9fbabae298054dd9eec574984acf3ab8b Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 29 Aug 2013 10:17:09 +0200 Subject: [PATCH] ox: Fix stack overflow in equal error (part 2) * lisp/ox.el (org-export-table-cell-alignment): Apply the same changes as in 2baa2c3afa70f86a6266b4bb9d5f763c5fb18388. --- lisp/ox.el | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/lisp/ox.el b/lisp/ox.el index 4c4cedb04..7dad90857 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -4517,14 +4517,17 @@ column (see `org-table-number-fraction' for more information). Possible values are `left', `right' and `center'." (let* ((row (org-export-get-parent table-cell)) (table (org-export-get-parent row)) - (column (let ((cells (org-element-contents row))) - (- (length cells) (length (memq table-cell cells))))) + (cells (org-element-contents row)) + (columns (length cells)) + (column (- columns (length (memq table-cell cells)))) (cache (or (plist-get info :table-cell-alignment-cache) (plist-get (setq info (plist-put info :table-cell-alignment-cache (make-hash-table :test 'equal))) - :table-cell-alignment-cache)))) - (or (gethash (cons table column) cache) + :table-cell-alignment-cache))) + (align-vector (or (gethash table cache) + (puthash table (make-vector columns nil) cache)))) + (or (aref align-vector column) (let ((number-cells 0) (total-cells 0) cookie-align @@ -4567,15 +4570,15 @@ Possible values are `left', `right' and `center'." (incf number-cells)))))) ;; Return value. Alignment specified by cookies has ;; precedence over alignment deduced from cell's contents. - (puthash (cons table column) - (cond ((equal cookie-align "l") 'left) - ((equal cookie-align "r") 'right) - ((equal cookie-align "c") 'center) - ((>= (/ (float number-cells) total-cells) - org-table-number-fraction) - 'right) - (t 'left)) - cache))))) + (aset align-vector + column + (cond ((equal cookie-align "l") 'left) + ((equal cookie-align "r") 'right) + ((equal cookie-align "c") 'center) + ((>= (/ (float number-cells) total-cells) + org-table-number-fraction) + 'right) + (t 'left))))))) (defun org-export-table-cell-borders (table-cell info) "Return TABLE-CELL borders.