From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: Babel trims leading 0s for certain numbers of tables Date: Sun, 10 Jul 2016 09:50:55 -0700 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:32811) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMHwf-0000CK-LY for emacs-orgmode@gnu.org; Sun, 10 Jul 2016 12:51:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bMHwZ-0006pX-ON for emacs-orgmode@gnu.org; Sun, 10 Jul 2016 12:51:04 -0400 Received: from iport-acv6-out.ucsd.edu ([132.239.0.13]:38763) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMHwZ-0006pL-G3 for emacs-orgmode@gnu.org; Sun, 10 Jul 2016 12:50:59 -0400 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.org@gnu.org Sender: "Emacs-orgmode" To: Ken Mankoff Cc: emacs orgmode-mailinglist On Sun, 10 Jul 2016, Ken Mankoff wrote: > > I've just discovered that when Org results are returned in a table, they > are modified in that leading 0s are removed. Is this a feature? A bug? Take your choice. The feature/bug happens deep down: - org-babel-execute-src-block - org-babel-execute:shell - org-babel-import-elisp-from-file - org-babel-string-read - org-babel-read which tries hard to convert strings to numbers. I haven't looked hard at this, but it seems like it would take a significant amount of tooling to set things up to make this conversion optional. > Is there a workaround for this? Leading 0s are not removed if the result > is a string, but in many cases a string of numbers is still a string and > should retain those 0s. Lots of ways, I guess. But they would all involve either tricking org-babel-read and then cleaning up the mess or processing the output outside of org-babel-import-from-elisp. For the latter, send the output to a file. Maybe use :file or pipe it from your script. Then visit the file, convert it to a table, and capture the result as a string. I think you can do this with a :post callout. HTH, Chuck