emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] Re: Org-Babel and Ledger


From: Eric Schulte
Subject: Re: [Orgmode] Re: Org-Babel and Ledger
Date: Fri, 30 Jul 2010 14:47:37 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Many languages import tabular contents into elisp tables which are then
inserted into Org-mode buffers as Org-formatted tables.  This should be
possible by replacing the call to `buffer-string' at the end of the
`org-babel-execute:ledger' function with something analogous to the
following (copied from ob-sqlite.el).

--8<---------------cut here---------------start------------->8---
(if (or (member "scalar" result-params)
              (member "html" result-params)
              (member "code" result-params)
              (equal (point-min) (point-max)))
          (buffer-string)
        (org-table-convert-region (point-min) (point-max))
        (org-babel-sqlite-table-or-scalar
         (org-babel-sqlite-offset-colnames
          (org-table-to-lisp) headers-p)))
--8<---------------cut here---------------end--------------->8---

I would recommend this approach over shell-script post-processing.

Best -- Eric

Eric Abrahamsen <address@hidden> writes:

> On Thu, Jul 29 2010, Sébastien Vauban wrote:
>
>
> [...]
>
>>
>> As you can see, the tables are completely wrongly made, because they're based
>> on spaces ("à la Awk") and not on fixed position of fields ("à la Cut").
>>
>> What can I do about this?
>>
>> - Post-process every ledger command with some awk or cut command that will do
>>   whatever is needed
>>
>> - Exploit the CSV export format (never tried, don't have Ledger 3 installed
>>   yet -- and I'm also using hledger...)
>>
>> - Other ideas?
>
>  Couldn't you use ledger's format strings for fine-tuned control of
>  the command output? I don't know how you're snarfing the output, but it
>  seems like you could using formatting to produce something that already
>  looks very much like an org table, or perhaps CSV.
>
> Eric
>
>>
>> Do you have suggestions about the best way to go?
>>
>> Best regards,
>>   Seb
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode



reply via email to

[Prev in Thread] Current Thread [Next in Thread]