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

Reply via email to