Function: org-table-current-field-formula
org-table-current-field-formula is a byte-compiled function defined in
org-table.el.gz.
Signature
(org-table-current-field-formula &optional KEY NOERROR)
Documentation
Return the formula active for the current field.
Assumes that table is already analyzed. If KEY is given, return the key to this formula. Otherwise return the formula preceded with "=" or ":=".
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-table.el.gz
;;; Formulas
(defun org-table-current-field-formula (&optional key noerror)
"Return the formula active for the current field.
Assumes that table is already analyzed. If KEY is given, return
the key to this formula. Otherwise return the formula preceded
with \"=\" or \":=\"."
(let* ((line (count-lines org-table-current-begin-pos
(line-beginning-position)))
(row (org-table-line-to-dline line)))
(cond
(row
(let* ((col (org-table-current-column))
(name (car (rassoc (list line col)
org-table-named-field-locations)))
(scol (format "$%d" col))
(ref (format "@%d$%d" (org-table-current-dline) col))
(stored-list (org-table-get-stored-formulas noerror))
(ass (or (assoc name stored-list)
(assoc ref stored-list)
(assoc scol stored-list))))
(cond (key (car ass))
(ass (concat (if (string-match-p "^[0-9]+$" (car ass)) "=" ":=")
(cdr ass))))))
(noerror nil)
(t (error "No formula active for the current field")))))