From: Rustom Mody <rustompmody@gmail.com>
To: William Henney <whenney@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>,
Nicolas Goaziou <n.goaziou@gmail.com>
Subject: orgmode tables for programmers (was table export to same buffer)
Date: Wed, 14 Aug 2013 12:54:04 +0530 [thread overview]
Message-ID: <CAJ+TeodGJECojwt0E8wxCRXF7b9nu7MW24ux3L4b6mqUiLNWhg@mail.gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 1143 bytes --]
On Mon, Aug 12, 2013 at 11:50 PM, William Henney <whenney@gmail.com> 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
[-- Attachment #1.2: Type: text/html, Size: 2022 bytes --]
[-- Attachment #2: orgtbl.py --]
[-- Type: application/octet-stream, Size: 664 bytes --]
# -*- eval: (orgtbl-mode); -*-
srctable = """
#+ORGTBL: SEND mytable orgtbl-to-generic :skip 1 :skipcols (2 3) :lfmt "\t\"%s\" : %s,"
| parameter | numerator | denominator | value |
|-----------+-----------+-------------+----------|
| a | 3.0 | 1.0 | 3.00000 |
| b | 14.0 | 7.0 | 2.00000 |
| c | -2.0 | 15.0 | -0.13333 |
#+TBLFM: $4=$2/$3;f5
"""
# With point in above table, "C-u C-u C-c C-c" will update formulae and install as python source-code
pytable = {
# BEGIN RECEIVE ORGTBL mytable
"a" : 3.00000,
"b" : 2.00000,
"c" : -0.13333,
# END RECEIVE ORGTBL mytable
}
next reply other threads:[~2013-08-14 7:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-14 7:24 Rustom Mody [this message]
2013-08-14 11:50 ` orgmode tables for programmers (was table export to same buffer) Rustom Mody
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=CAJ+TeodGJECojwt0E8wxCRXF7b9nu7MW24ux3L4b6mqUiLNWhg@mail.gmail.com \
--to=rustompmody@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=n.goaziou@gmail.com \
--cc=whenney@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).