Function: org-table-remote-reference-indirection

org-table-remote-reference-indirection is a byte-compiled function defined in org-table.el.gz.

Signature

(org-table-remote-reference-indirection FORM)

Documentation

Return formula with table remote references substituted by indirection.

For example "remote($1, @>$2)" => "remote(year_2013, @>$1)". This indirection works only with the format @ROW$COLUMN. The format "B3" is not supported because it can not be distinguished from a plain table name or ID.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-table.el.gz
(defun org-table-remote-reference-indirection (form)
  "Return formula with table remote references substituted by indirection.
For example \"remote($1, @>$2)\" => \"remote(year_2013, @>$1)\".
This indirection works only with the format @ROW$COLUMN.  The
format \"B3\" is not supported because it can not be
distinguished from a plain table name or ID."
  (let ((regexp
	 ;; Same as in `org-table-eval-formula'.
	 (concat "\\<remote([ \t]*\\("
		 ;; Allow "$1", "@<", "$-1", "@<<$1" etc.
		 "[@$][^ \t,]+"
		 "\\)[ \t]*,[ \t]*\\([^\n)]+\\))")))
    (replace-regexp-in-string
     regexp
     (lambda (m)
       (save-match-data
	 (let ((eq (org-table-formula-handle-first/last-rc (match-string 1 m))))
	   (org-table-get-range
	    (if (string-match-p "\\`\\$[0-9]+\\'" eq)
		(concat "@0" eq)
	      eq)))))
     form t t 1)))