From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rustom Mody Subject: orgmode tables for programmers (was table export to same buffer) Date: Wed, 14 Aug 2013 12:54:04 +0530 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=e89a8fb1f56c387e5204e3e33fcd Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49303) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V9VRS-00073G-WC for emacs-orgmode@gnu.org; Wed, 14 Aug 2013 03:24:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V9VRR-0008SO-LI for emacs-orgmode@gnu.org; Wed, 14 Aug 2013 03:24:26 -0400 Received: from mail-ob0-x231.google.com ([2607:f8b0:4003:c01::231]:57048) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V9VRR-0008SI-E8 for emacs-orgmode@gnu.org; Wed, 14 Aug 2013 03:24:25 -0400 Received: by mail-ob0-f177.google.com with SMTP id f8so1278112obp.36 for ; Wed, 14 Aug 2013 00:24:24 -0700 (PDT) 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: William Henney Cc: emacs-orgmode , Nicolas Goaziou --e89a8fb1f56c387e5204e3e33fcd Content-Type: multipart/alternative; boundary=e89a8fb1f56c387e4e04e3e33fcb --e89a8fb1f56c387e4e04e3e33fcb Content-Type: text/plain; charset=ISO-8859-1 On Mon, Aug 12, 2013 at 11:50 PM, William Henney wrote: > > The template is not strictly necessary - you can just add the required > lines by hand to your C source file. > I think that orgtbl-to-generic should be able to do what you want out of > the box. Maybe the attached example (orgtbl-test.c) might help you. The > idea is that you edit the org table at the top, then "C-u C-u C-c C-c" will > update all the formulae in the table and install the results in your C > source code at the bottom. This is not quite what you originally asked > for, since you have two copies of the data in the file and you have to > remember to only edit the version in the org table. But it is pretty > close. > > Cheers > > Will > > Thanks Will. Ive converted your code to python (attached). I find it works in org 8 but not in 6.33 -- the default for emacs on debian. Is it easy to make it work for earlier org also?? Reason: This question was asked on the python list: thread starting http://mail.python.org/pipermail/python-list/2013-July/653164.html And so it would be good to have an example that works mostly out of the box --e89a8fb1f56c387e4e04e3e33fcb Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On M= on, Aug 12, 2013 at 11:50 PM, William Henney <whenney@gmail.com> wrote:

The template is not stric= tly necessary - you can just add the required lines by hand to your C sourc= e file.=A0
I think that orgtbl-to-generic should be able to do what you want out of th= e box. =A0Maybe the attached example (orgtbl-test.c) might help you. =A0The= idea is that you edit the org table at the top, then "C-u C-u C-c C-c= " will update all the formulae in the table and install the results in= your C source code at the bottom. =A0This is not quite what you originally= asked for, since you have two copies of the data in the file and you have = to remember to only edit the version in the org table. =A0But it is pretty = close.=A0

Cheers

Will


Thanks = Will.
Ive converted your code to python= (attached).
I find it works in org 8 b= ut not in 6.33 -- the default for emacs on debian.
Is it easy to make it work for earlier org= also??

Reason: This question was a= sked on the python list: thread starting
http://mail.python.org/pipe= rmail/python-list/2013-July/653164.html
And so it would be good to have an example= that works mostly out of the box

<= /div>
--e89a8fb1f56c387e4e04e3e33fcb-- --e89a8fb1f56c387e5204e3e33fcd Content-Type: application/octet-stream; name="orgtbl.py" Content-Disposition: attachment; filename="orgtbl.py" Content-Transfer-Encoding: base64 X-Attachment-Id: f_hkc7lljz1 IyAtKi0gZXZhbDogKG9yZ3RibC1tb2RlKTsgLSotCgoKc3JjdGFibGUgPSAiIiIKIytPUkdUQkw6 IFNFTkQgbXl0YWJsZSBvcmd0YmwtdG8tZ2VuZXJpYyA6c2tpcCAxIDpza2lwY29scyAoMiAzKSA6 bGZtdCAiXHRcIiVzXCIgOiAlcywiCnwgcGFyYW1ldGVyIHwgbnVtZXJhdG9yIHwgZGVub21pbmF0 b3IgfCAgICB2YWx1ZSB8CnwtLS0tLS0tLS0tLSstLS0tLS0tLS0tLSstLS0tLS0tLS0tLS0tKy0t LS0tLS0tLS18CnwgYSAgICAgICAgIHwgICAgICAgMy4wIHwgICAgICAgICAxLjAgfCAgMy4wMDAw MCB8CnwgYiAgICAgICAgIHwgICAgICAxNC4wIHwgICAgICAgICA3LjAgfCAgMi4wMDAwMCB8Cnwg YyAgICAgICAgIHwgICAgICAtMi4wIHwgICAgICAgIDE1LjAgfCAtMC4xMzMzMyB8CiMrVEJMRk06 ICQ0PSQyLyQzO2Y1CgoiIiIKCiMgV2l0aCBwb2ludCBpbiBhYm92ZSB0YWJsZSwgIkMtdSBDLXUg Qy1jIEMtYyIgd2lsbCB1cGRhdGUgZm9ybXVsYWUgYW5kIGluc3RhbGwgYXMgcHl0aG9uIHNvdXJj ZS1jb2RlCgoKcHl0YWJsZSA9IHsKICAgICMgQkVHSU4gUkVDRUlWRSBPUkdUQkwgbXl0YWJsZQoJ ImEiIDogMy4wMDAwMCwKCSJiIiA6IDIuMDAwMDAsCgkiYyIgOiAtMC4xMzMzMywKICAgICMgRU5E IFJFQ0VJVkUgT1JHVEJMIG15dGFibGUKICAgICAgICB9CgoKCg== --e89a8fb1f56c387e5204e3e33fcd--