org-table-convert-refs-to-rc: Fix failing test

* lisp/org-table.el (org-table-convert-refs-to-an): Leave $0
references (current row) unchanged during conversion.
*
testing/lisp/test-org-table.el (test-org-table/org-table-convert-refs-to-an/2):
Re-enable the failing test.
This commit is contained in:
Ihor Radchenko 2022-11-25 14:45:09 +08:00
parent 5337a49f32
commit c72d5ee840
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
2 changed files with 8 additions and 7 deletions

View File

@ -3441,7 +3441,9 @@ full TBLFM line."
(defun org-table-convert-refs-to-an (s)
"Convert spreadsheet references from to @7$28 to AB7.
Works for single references, but also for entire formulas and even the
full TBLFM line."
full TBLFM line.
Leave the relative references unchanged."
(while (string-match "@\\([0-9]+\\)\\$\\([0-9]+\\)" s)
(setq s (replace-match
(format "%s%d"
@ -3449,7 +3451,7 @@ full TBLFM line."
(string-to-number (match-string 2 s)))
(string-to-number (match-string 1 s)))
t t s)))
(while (string-match "\\(^\\|[^0-9a-zA-Z]\\)\\$\\([0-9]+\\)" s)
(while (string-match "\\(^\\|[^0-9a-zA-Z]\\)\\$\\([1-9][0-9]*\\)" s)
(setq s (replace-match (concat "\\1"
(org-number-to-letters
(string-to-number (match-string 2 s))) "&")

View File

@ -993,11 +993,10 @@ See also URL `https://orgmode.org/worg/org-tutorials/org-lookups.html'."
(should
(string= "A2" (org-table-convert-refs-to-an "@2$1"))))
;; TODO: Test broken
;; (ert-deftest test-org-table/org-table-convert-refs-to-an/2 ()
;; "Self reference @1$1."
;; (should
;; (string= "A1 = $0" (org-table-convert-refs-to-an "@1$1 = $0"))))
(ert-deftest test-org-table/org-table-convert-refs-to-an/2 ()
"Self reference @1$1."
(should
(string= "A1 = $0" (org-table-convert-refs-to-an "@1$1 = $0"))))
(ert-deftest test-org-table/org-table-convert-refs-to-an/3 ()
"Remote reference."