Function: org-table-convert-refs-to-rc
org-table-convert-refs-to-rc is a byte-compiled function defined in
org-table.el.gz.
Signature
(org-table-convert-refs-to-rc S)
Documentation
Convert spreadsheet references from A7 to @7$28.
Works for single references, but also for entire formulas and even the full TBLFM line.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-table.el.gz
(defun org-table-convert-refs-to-rc (s)
"Convert spreadsheet references from A7 to @7$28.
Works for single references, but also for entire formulas and even the
full TBLFM line."
(let ((start 0))
(while (string-match "\\<\\([a-zA-Z]+\\)\\([0-9]+\\>\\|&\\)\\|\\(;[^\r\n:]+\\|\\<remote([^,)]*)\\)" s start)
(cond
((match-end 3)
;; format match, just advance
(setq start (match-end 0)))
((and (> (match-beginning 0) 0)
(equal ?. (aref s (max (1- (match-beginning 0)) 0)))
(not (equal ?. (aref s (max (- (match-beginning 0) 2) 0)))))
;; 3.e5 or something like this.
(setq start (match-end 0)))
((or (> (- (match-end 1) (match-beginning 1)) 2)
;; (member (match-string 1 s)
;; '("arctan" "exp" "expm" "lnp" "log" "stir"))
)
;; function name, just advance
(setq start (match-end 0)))
(t
(setq start (match-beginning 0)
s (replace-match
(if (equal (match-string 2 s) "&")
(format "$%d" (org-letters-to-number (match-string 1 s)))
(format "@%d$%d"
(string-to-number (match-string 2 s))
(org-letters-to-number (match-string 1 s))))
t t s)))))
s))