From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: Re: Org-Babel and Ledger Date: Fri, 30 Jul 2010 14:47:37 -0600 Message-ID: <87tyng66ja.fsf@gmail.com> References: <87eiemsk0m.fsf@mundaneum.com> <87fwz2b634.fsf@pellet.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=36597 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oewb7-0001IS-TF for emacs-orgmode@gnu.org; Fri, 30 Jul 2010 16:54:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OewUZ-0003Db-Ba for emacs-orgmode@gnu.org; Fri, 30 Jul 2010 16:47:44 -0400 Received: from mail-px0-f169.google.com ([209.85.212.169]:43552) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OewUZ-0003DN-1e for emacs-orgmode@gnu.org; Fri, 30 Jul 2010 16:47:43 -0400 Received: by pxi7 with SMTP id 7so1310292pxi.0 for ; Fri, 30 Jul 2010 13:47:41 -0700 (PDT) In-Reply-To: <87fwz2b634.fsf@pellet.net> (Eric Abrahamsen's message of "Thu, 29 Jul 2010 09:33:51 -0700") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Abrahamsen Cc: emacs-orgmode@gnu.org 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 writes: > On Thu, Jul 29 2010, S=C3=A9bastien Vauban wrote: > > > [...] > >> >> As you can see, the tables are completely wrongly made, because they're = based >> on spaces ("=C3=A0 la Awk") and not on fixed position of fields ("=C3=A0= la Cut"). >> >> What can I do about this? >> >> - Post-process every ledger command with some awk or cut command that wi= ll do >> whatever is needed >> >> - Exploit the CSV export format (never tried, don't have Ledger 3 instal= led >> 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. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode