Function: org-table-get-stored-formulas

org-table-get-stored-formulas is an autoloaded and byte-compiled function defined in org-table.el.gz.

Signature

(org-table-get-stored-formulas &optional NOERROR LOCATION)

Documentation

Return an alist with the stored formulas directly after current table.

By default, only return active formulas, i.e., formulas located on the first line after the table. However, if optional argument LOCATION is a buffer position, consider the formulas there.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-table.el.gz
;;;###autoload
(defun org-table-get-stored-formulas (&optional noerror location)
  "Return an alist with the stored formulas directly after current table.
By default, only return active formulas, i.e., formulas located
on the first line after the table.  However, if optional argument
LOCATION is a buffer position, consider the formulas there."
  (save-excursion
    (if location
	(progn (goto-char location) (forward-line 0))
      (goto-char (org-table-end)))
    (let ((case-fold-search t))
      (when (looking-at "\\([ \t]*\n\\)*[ \t]*#\\+TBLFM: *\\(.*\\)")
	(let ((strings (org-split-string (match-string-no-properties 2)
					 " *:: *"))
	      eq-alist seen)
	  (dolist (string strings (nreverse eq-alist))
	    (when (string-match "\\`\\(@[-+I<>0-9.$@]+\\|\\$\\([_a-zA-Z0-9]+\\|\
\[<>]+\\)\\) *= *\\(.*[^ \t]\\)"
				string)
	      (let ((lhs
		     (let ((m (match-string 1 string)))
		       (cond
			((not (match-end 2)) m)
			;; Is it a column reference?
			((string-match-p "\\`\\$\\([0-9]+\\|[<>]+\\)\\'" m) m)
			;; Since named columns are not possible in
			;; LHS, assume this is a named field.
			(t (match-string 2 string)))))
		    (rhs (match-string 3 string)))
		(push (cons lhs rhs) eq-alist)
		(cond
		 ((not (member lhs seen)) (push lhs seen))
		 (noerror
		  (message
		   "Double definition `%s=' in TBLFM line, please fix by hand"
		   lhs)
		  (ding)
		  (sit-for 2))
		 (t
		  (user-error
		   "Double definition `%s=' in TBLFM line, please fix by hand"
		   lhs)))))))))))