emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org c72d5ee840: org-table-convert-refs-to-rc: Fix faili


From: ELPA Syncer
Subject: [elpa] externals/org c72d5ee840: org-table-convert-refs-to-rc: Fix failing test
Date: Fri, 25 Nov 2022 01:58:01 -0500 (EST)

branch: externals/org
commit c72d5ee840256ca5d5b2e1b06617bf56c7dc435c
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>

    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.
---
 lisp/org-table.el              | 6 ++++--
 testing/lisp/test-org-table.el | 9 ++++-----
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/lisp/org-table.el b/lisp/org-table.el
index fda955c1d0..8e0e8e6cf8 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -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))) "&")
diff --git a/testing/lisp/test-org-table.el b/testing/lisp/test-org-table.el
index 98663c8838..5b5b5225a6 100644
--- a/testing/lisp/test-org-table.el
+++ b/testing/lisp/test-org-table.el
@@ -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."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]