On Thu, Feb 27, 2020 at 9:13 AM Kaushal Modi <kaushal.m...@gmail.com> wrote:

> The regression is caused by
> https://code.orgmode.org/bzg/org-mode/commit/6b2a7cb20b357e730de151522fe4204c96615f98
> or the later commit that changes `org-babel--string-to-number'.
>
> Using this function redefinition with additional debug messages:
>
> (defun org-babel--string-to-number (string)
>   "If STRING represents a number return its value.
> Otherwise return nil."
>   (message "DBG: string: %S" string)
>   (unless (string-match-p "\\s-" (org-trim string))
>     (let ((interned-string (ignore-errors (read string))))
>       (when (numberp interned-string)
>         (message "DBG: interned string: %S" interned-string)
> interned-string))))
>
> I get:
>
> DBG: string: "1,3-5"
> DBG: interned string: 1
>
> So that ",3-5" piece of information is lost.
>

To be more specific, here is the call order:

org-babel-parse-header-arguments -> org-babel-read ->
org-babel--string-to-number

org-babel-read returns the string as-is if org-babel--string-to-number
returns nil.

*The regression is that earlier (org-babel--string-to-number "1,3-5") used
to return nil, but now it returns 1.*

I think that it should return a number only if 100% of the input string
represents a number. In the case of "1,3-5", it makes sense for it to still
return nil, so that org-babel-read does not throw away the ",3-5" piece of
information.

Reply via email to