Function: org-ascii--table-cell-width
org-ascii--table-cell-width is a byte-compiled function defined in
ox-ascii.el.gz.
Signature
(org-ascii--table-cell-width TABLE-CELL INFO)
Documentation
Return width of TABLE-CELL.
INFO is a plist used as a communication channel.
Width of a cell is determined either by a width cookie in the same column as the cell, or by the maximum cell's length in that column.
When org-ascii-table-widen-columns is non-nil, width cookies
are ignored.
Source Code
;; Defined in /usr/src/emacs/lisp/org/ox-ascii.el.gz
;;;; Table Cell
(defun org-ascii--table-cell-width (table-cell info)
"Return width of TABLE-CELL.
INFO is a plist used as a communication channel.
Width of a cell is determined either by a width cookie in the
same column as the cell, or by the maximum cell's length in that
column.
When `org-ascii-table-widen-columns' is non-nil, width cookies
are ignored."
(let* ((row (org-export-get-parent table-cell))
(table (org-export-get-parent row))
(col (let ((cells (org-element-contents row)))
(- (length cells) (length (memq table-cell cells)))))
(cache
(or (plist-get info :ascii-table-cell-width-cache)
(plist-get (setq info
(plist-put info :ascii-table-cell-width-cache
(make-hash-table :test 'equal)))
:ascii-table-cell-width-cache)))
(key (cons table col))
(widenp (plist-get info :ascii-table-widen-columns)))
(or (gethash key cache)
(puthash
key
(let ((cookie-width (org-export-table-cell-width table-cell info)))
(or (and (not widenp) cookie-width)
(let ((contents-width
(let ((max-width 0))
(org-element-map table 'table-row
(lambda (row)
(setq max-width
(max (string-width
(org-export-data
(org-element-contents
(elt (org-element-contents row) col))
info))
max-width)))
info)
max-width)))
(cond ((not cookie-width) contents-width)
(widenp (max cookie-width contents-width))
(t cookie-width)))))
cache))))