emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Charles C. Berry" <ccberry@ucsd.edu>
To: Ken Mankoff <mankoff@gmail.com>
Cc: emacs orgmode-mailinglist <emacs-orgmode@gnu.org>
Subject: Re: Babel trims leading 0s for certain numbers of tables
Date: Sun, 10 Jul 2016 09:50:55 -0700	[thread overview]
Message-ID: <alpine.OSX.2.20.1607100918120.622@charles-berrys-macbook.local> (raw)
In-Reply-To: <m2wpktacsb.fsf@gmail.com>

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

  parent reply	other threads:[~2016-07-10 16:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-10 12:38 Babel trims leading 0s for certain numbers of tables Ken Mankoff
2016-07-10 13:18 ` Eric Abrahamsen
2016-07-10 13:35   ` Ken Mankoff
2016-07-10 16:50 ` Charles C. Berry [this message]
2016-07-10 17:37   ` Ken Mankoff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.OSX.2.20.1607100918120.622@charles-berrys-macbook.local \
    --to=ccberry@ucsd.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=mankoff@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).