Function: org-table-shift-refpart
org-table-shift-refpart is a byte-compiled function defined in
org-table.el.gz.
Signature
(org-table-shift-refpart REF &optional DECR HLINE)
Documentation
Shift a reference part REF.
If DECR is set, decrease the references row/column, else increase. If HLINE is set, this may be a hline reference, it certainly is not a translation reference.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-table.el.gz
(defun org-table-shift-refpart (ref &optional decr hline)
"Shift a reference part REF.
If DECR is set, decrease the references row/column, else increase.
If HLINE is set, this may be a hline reference, it certainly is not
a translation reference."
(save-match-data
(let* ((sign (string-match "^[-+]" ref)) n)
(if sign (setq sign (substring ref 0 1) ref (substring ref 1)))
(cond
((and hline (string-match "^I+" ref))
(setq n (string-to-number (concat sign (number-to-string (length ref)))))
(setq n (+ n (if decr -1 1)))
(if (= n 0) (setq n (+ n (if decr -1 1))))
(if sign
(setq sign (if (< n 0) "-" "+") n (abs n))
(setq n (max 1 n)))
(concat sign (make-string n ?I)))
((string-match "^[0-9]+" ref)
(setq n (string-to-number (concat sign ref)))
(setq n (+ n (if decr -1 1)))
(if sign
(concat (if (< n 0) "-" "+") (number-to-string (abs n)))
(number-to-string (max 1 n))))
((string-match "^[a-zA-Z]+" ref)
(org-number-to-letters
(max 1 (+ (org-letters-to-number ref) (if decr -1 1)))))
(t (user-error "Cannot shift reference"))))))