diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 1e13aa51d..03a187eac 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -2849,24 +2849,20 @@ Otherwise if CELL looks like lisp (meaning it starts with a lisp, otherwise return it unmodified as a string. Optional argument INHIBIT-LISP-EVAL inhibits lisp evaluation for situations in which is it not appropriate." - (if (and (stringp cell) (not (equal cell ""))) - (or (org-babel--string-to-number cell) - (if (and (not inhibit-lisp-eval) - (or (member (substring cell 0 1) '("(" "'" "`" "[")) - (string= cell "*this*"))) - (eval (read cell) t) - (if (string= (substring cell 0 1) "\"") - (read cell) - (progn (set-text-properties 0 (length cell) nil cell) cell)))) - cell)) + (cond ((not (org-string-nw-p cell)) cell) + ((org-babel--string-to-number cell)) + ((and (not inhibit-lisp-eval) + (or (memq (string-to-char cell) '(?\( ?' ?` ?\[)) + (string= cell "*this*"))) + (eval (read cell) t)) + ((eq (string-to-char cell) ?\") (read cell)) + (t (org-no-properties cell)))) (defun org-babel--string-to-number (string) "If STRING represents a number return its value. - Otherwise return nil." - (when (string-match "\\`-?[0-9]*\\.?[0-9]*\\'" string) - (string-to-number string))) -(define-obsolete-function-alias 'org-babel-number-p 'org-babel--string-to-number "Org 9.0") + (and (string-match-p "\\`-?[0-9]*\\.?[0-9]*\\'" string) + (string-to-number string))) (defun org-babel-import-elisp-from-file (file-name &optional separator) "Read the results located at FILE-NAME into an elisp table. diff --git a/lisp/org-compat.el b/lisp/org-compat.el index f4d389e52..1f2dd8071 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -286,6 +286,11 @@ See `org-link-parameters' for documentation on the other parameters." (org-unbracket-string "\"" "\"" s)) (make-obsolete 'org-remove-double-quotes 'org-unbracket-string "Org 9.0") +(define-obsolete-function-alias 'org-babel-number-p + 'org-babel--string-to-number "Org 9.0") + + + ;;;; Obsolete link types (eval-after-load 'org