Function: org-table-calc-current-TBLFM
org-table-calc-current-TBLFM is an interactive and byte-compiled
function defined in org-table.el.gz.
Signature
(org-table-calc-current-TBLFM &optional ARG)
Documentation
Apply the #+TBLFM in the line at point to the table.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-table.el.gz
(defun org-table-calc-current-TBLFM (&optional arg)
"Apply the #+TBLFM in the line at point to the table."
(interactive "P")
(unless (org-at-TBLFM-p) (user-error "Not at a #+TBLFM line"))
(let ((formula (buffer-substring
(line-beginning-position)
(line-end-position))))
(save-excursion
;; Insert a temporary formula at right after the table
(goto-char (org-table-TBLFM-begin))
(let ((s (point-marker)))
(insert formula "\n")
(let ((e (point-marker)))
;; Recalculate the table.
(forward-line -1) ; move to the inserted line
(skip-chars-backward " \r\n\t")
(unwind-protect
(org-call-with-arg #'org-table-recalculate (or arg t))
;; Delete the formula inserted temporarily.
(delete-region s e)
(set-marker s nil)
(set-marker e nil)))))))