* orgmode tables for programmers (was table export to same buffer)
@ 2013-08-14 7:24 Rustom Mody
2013-08-14 11:50 ` Rustom Mody
0 siblings, 1 reply; 2+ messages in thread
From: Rustom Mody @ 2013-08-14 7:24 UTC (permalink / raw)
To: William Henney; +Cc: emacs-orgmode, Nicolas Goaziou
[-- 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
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: orgmode tables for programmers (was table export to same buffer)
2013-08-14 7:24 orgmode tables for programmers (was table export to same buffer) Rustom Mody
@ 2013-08-14 11:50 ` Rustom Mody
0 siblings, 0 replies; 2+ messages in thread
From: Rustom Mody @ 2013-08-14 11:50 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 418 bytes --]
On Wed, Aug 14, 2013 at 12:54 PM, Rustom Mody <rustompmody@gmail.com> wrote:
> 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??
>
>
Ok Ive managed to hack up something: The attached works in org 6.33 and
8.0.7
Just one small help needed:
How to split the very long line
#+ORGTBL SEND mytable...
into multiple lines??
Regards
Rusi
[-- Attachment #1.2: Type: text/html, Size: 894 bytes --]
[-- Attachment #2: orgtbl6.33.py --]
[-- Type: application/octet-stream, Size: 692 bytes --]
# -*- eval: (orgtbl-mode); -*-
srctable = """
#+ORGTBL: SEND mytable orgtbl-to-generic :skip 1 :skipcols (2 3) :fmt (1 "\t\"%s\" : ") (2 "%s") :lstart "\t" :lend ","
| parameter | numerator | denominator | value |
|-----------+-----------+-------------+----------|
| a | 3.0 | 3.0 | 1.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-c C-c" will
# update formulae and install as python source-code
pytable = {
# BEGIN RECEIVE ORGTBL mytable
"a" : 1.00000
"b" : 2.00000
"c" : -0.13333
# END RECEIVE ORGTBL mytable
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-08-14 11:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-14 7:24 orgmode tables for programmers (was table export to same buffer) Rustom Mody
2013-08-14 11:50 ` Rustom Mody
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.