From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Re: Debugging at least 2 regressions in org-mode master breaking ox-hugo Date: Thu, 27 Feb 2020 09:19:42 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000009d7d7c059f8f6b46" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:45443) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j7K1V-000478-Q8 for emacs-orgmode@gnu.org; Thu, 27 Feb 2020 09:20:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j7K1U-0002Qu-FW for emacs-orgmode@gnu.org; Thu, 27 Feb 2020 09:20:21 -0500 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Sender: "Emacs-orgmode" To: emacs-org list , Bastien Guerry --0000000000009d7d7c059f8f6b46 Content-Type: text/plain; charset="UTF-8" On Thu, Feb 27, 2020 at 9:13 AM Kaushal Modi 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. --0000000000009d7d7c059f8f6b46 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Feb 27, 2020 at 9:13 AM Kaushal Modi <kaushal.modi@gmail.com> wrote:
The regression is caused by https://code.orgmode.org/bzg/org-mode/commit/6b2a7cb20b357e730de151= 522fe4204c96615f98 or the later commit that changes `org-babel--string-= to-number'.

Using this function redefinition with ad= ditional debug messages:

(defun org-babel--string-= to-number (string)
=C2=A0 "If STRING represents a number return its= value.
Otherwise return nil."
=C2=A0 (message "DBG: string= : %S" string)
=C2=A0 (unless (string-match-p "\\s-" (org-= trim string))
=C2=A0 =C2=A0 (let ((interned-string (ignore-errors (read = string))))
=C2=A0 =C2=A0 =C2=A0 (when (numberp interned-string)
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 (message "DBG: interned string: %S" inte= rned-string)
interned-string))))

I get:
<= div>
DBG: string: "1,3-5"
DBG: interned string: = 1

So that ",3-5" piece of information is= lost.

To be more spe= cific, here is the call order:

org-babel-parse-header-arguments -> org-babel-read -> org-babel--stri= ng-to-number

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

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

I thi= nk that it should return a number only if 100% of the input string represen= ts a number. In the case of "1,3-5", it makes sense for it to sti= ll return nil, so that org-babel-read does not throw away the ",3-5&qu= ot; piece of information.


--0000000000009d7d7c059f8f6b46--