summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2013-05-20 11:33:11 +0200
committerNicolas Goaziou <n.goaziou@gmail.com>2013-05-20 11:33:11 +0200
commit4daf9d60d913da6d4d086b05b38974779859a52d (patch)
tree1adfd60afbf94e0d02e7bfe5dbfbe69f2f5a03db
parentaafb2d2b46ab4aded295ea9a81e8e2840628dc64 (diff)
downloadorg-mode-4daf9d60d913da6d4d086b05b38974779859a52d.tar.gz
ox: Small fix to cell width caching mechanism
* lisp/ox.el (org-export-table-cell-width): Be sure to use cache even when stored value is nil.
-rw-r--r--lisp/ox.el40
1 files changed, 20 insertions, 20 deletions
diff --git a/lisp/ox.el b/lisp/ox.el
index 6752612..5c8dfdd 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -4481,26 +4481,26 @@ same column as TABLE-CELL, or nil."
(plist-put info :table-cell-width-cache
(make-hash-table :test 'equal)))
:table-cell-width-cache)))
- (key (cons table column)))
- (or (let ((cached (gethash key cache 'no-result)))
- (and (not (eq cached 'no-result)) cached))
- (let (cookie-width)
- (dolist (row (org-element-contents table)
- (puthash key cookie-width cache))
- (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
- (elt (org-element-contents row) column)))
- (cookie (car value)))
- ;; The following checks avoid expanding unnecessarily the
- ;; cell with `org-export-data'
- (when (and value
- (not (cdr value))
- (stringp cookie)
- (string-match "\\`<[lrc]?\\([0-9]+\\)?>\\'" cookie)
- (match-string 1 cookie))
- (setq cookie-width
- (string-to-number (match-string 1 cookie)))))))))))
+ (key (cons table column))
+ (value (gethash key cache 'no-result)))
+ (if (not (eq value 'no-result)) value
+ (let (cookie-width)
+ (dolist (row (org-element-contents table)
+ (puthash key cookie-width cache))
+ (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
+ (elt (org-element-contents row) column)))
+ (cookie (car value)))
+ ;; The following checks avoid expanding unnecessarily
+ ;; the cell with `org-export-data'.
+ (when (and value
+ (not (cdr value))
+ (stringp cookie)
+ (string-match "\\`<[lrc]?\\([0-9]+\\)?>\\'" cookie)
+ (match-string 1 cookie))
+ (setq cookie-width
+ (string-to-number (match-string 1 cookie)))))))))))
(defun org-export-table-cell-alignment (table-cell info)
"Return TABLE-CELL contents alignment.