From 2baa2c3afa70f86a6266b4bb9d5f763c5fb18388 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 29 Aug 2013 10:00:24 +0200 Subject: [PATCH] ox: Fix stack overflow in equal error * lisp/ox.el (org-export-table-cell-width): Modify key (now an element) and value structure (now a vector) of cache so it can use `eq' as test. Elements are circular lists so `equal' cannot apply on them. Reported-by: Jambunathan K --- lisp/ox.el | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lisp/ox.el b/lisp/ox.el index 642700780..4c4cedb04 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -4475,19 +4475,21 @@ Return value is the width given by the last width cookie in the same column as TABLE-CELL, or nil." (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-width-cache) (plist-get (setq info (plist-put info :table-cell-width-cache - (make-hash-table :test 'equal))) + (make-hash-table :test 'eq))) :table-cell-width-cache))) - (key (cons table column)) - (value (gethash key cache 'no-result))) - (if (not (eq value 'no-result)) value + (width-vector (or (gethash table cache) + (puthash table (make-vector columns 'empty) cache))) + (value (aref width-vector column))) + (if (not (eq value 'empty)) value (let (cookie-width) (dolist (row (org-element-contents table) - (puthash key cookie-width cache)) + (aset width-vector column cookie-width)) (when (org-export-table-row-is-special-p row info) ;; In a special row, try to find a width cookie at COLUMN. (let* ((value (org-element-contents