From 6b2a7cb20b357e730de151522fe4204c96615f98 Mon Sep 17 00:00:00 2001 From: Bastien Date: Wed, 19 Feb 2020 10:39:37 +0100 Subject: [PATCH] ob-core.el: Correctly interpret all numbers * lisp/ob-core.el (org-babel--string-to-number): Correctly interpret all numbers. Thanks to Vladimir Nikishkin for reporting this. --- lisp/ob-core.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index a6368ad85..7846474b6 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -2932,8 +2932,9 @@ situations in which is it not appropriate." (defun org-babel--string-to-number (string) "If STRING represents a number return its value. Otherwise return nil." - (and (string-match-p "\\`-?\\([0-9]\\|\\([1-9]\\|[0-9]*\\.\\)[0-9]*\\)\\'" string) - (string-to-number string))) + (let ((interned-string (ignore-errors (read string)))) + (when (numberp interned-string) + interned-string))) (defun org-babel-import-elisp-from-file (file-name &optional separator) "Read the results located at FILE-NAME into an elisp table.