From 0ce406151f2559ddc6bbdb7e4ccbae9e5742f45a Mon Sep 17 00:00:00 2001 From: Michael Brand Date: Fri, 28 Dec 2012 15:00:03 +0100 Subject: [PATCH] Extend org-table-number-regexp * lisp/org-table.el (org-table-number-regexp): Extend 0x hex to fixed-point number, add #, add Calc infinite numbers uinf, -inf and inf. * testing/lisp/test-org-table.el (test-org-table/align): Adapt alignment. --- lisp/org-table.el | 10 +++++----- testing/lisp/test-org-table.el | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lisp/org-table.el b/lisp/org-table.el index 509a1ef3b..6a9d0b4a4 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -112,7 +112,7 @@ table, obtained by prompting the user." :type 'string) (defcustom org-table-number-regexp - "^\\([<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%:]*\\|\\(0[xX]\\)[0-9a-fA-F]+\\|nan\\)$" + "^\\([<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%:]*\\|[<>]?[-+]?0[xX][0-9a-fA-F.]+\\|[<>]?[-+]?[0-9]+#[0-9a-zA-Z.]+\\|nan\\|[-+u]?inf\\)$" "Regular expression for recognizing numbers in table columns. If a table column contains mostly numbers, it will be aligned to the right. If not, it will be aligned to the left. @@ -136,10 +136,10 @@ Other options offered by the customize interface are more restrictive." "^[-+]?\\([0-9]*\\.[0-9]+\\|[0-9]+\\.?[0-9]*\\)$") (const :tag "Exponential, Floating point, Integer" "^[-+]?[0-9.]+\\([eEdD][-+0-9]+\\)?$") - (const :tag "Very General Number-Like, including hex" - "^\\([<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%]*\\|\\(0[xX]\\)[0-9a-fA-F]+\\|nan\\)$") - (const :tag "Very General Number-Like, including hex, allows comma as decimal mark" - "^\\([<>]?[-+^.,0-9]*[0-9][-+^.0-9eEdDx()%]*\\|\\(0[xX]\\)[0-9a-fA-F]+\\|nan\\)$") + (const :tag "Very General Number-Like, including hex and Calc radix" + "^\\([<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%]*\\|[<>]?[-+]?0[xX][0-9a-fA-F.]+\\|[<>]?[-+]?[0-9]+#[0-9a-zA-Z.]+\\|nan\\|[-+u]?inf\\)$") + (const :tag "Very General Number-Like, including hex and Calc radix, allows comma as decimal mark" + "^\\([<>]?[-+^.,0-9]*[0-9][-+^.0-9eEdDx()%]*\\|[<>]?[-+]?0[xX][0-9a-fA-F.]+\\|[<>]?[-+]?[0-9]+#[0-9a-zA-Z.]+\\|nan\\|[-+u]?inf\\)$") (string :tag "Regexp:"))) (defcustom org-table-number-fraction 0.5 diff --git a/testing/lisp/test-org-table.el b/testing/lisp/test-org-table.el index 4c899a86b..89704ff83 100644 --- a/testing/lisp/test-org-table.el +++ b/testing/lisp/test-org-table.el @@ -32,9 +32,9 @@ | ab | ab | ab | ab | ab | ab | ab | ab | ") (org-test-table-target-expect " -| 0 | 0 | 0 | 0 | 0 | 0 | +| 0 | 0 | 0 | 0 | 0 | 0 | | <-0x0ab.cf | >-36#0vw.yz | nan | uinf | -inf | inf | -| ab | ab | ab | ab | ab | ab | +| ab | ab | ab | ab | ab | ab | ")) (ert-deftest test-org-table/org-table-convert-refs-to-an/1 () -- 2.11.4.GIT