emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: William Henney <whenney@gmail.com>
To: Rustom Mody <rustompmody@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>,
	Nicolas Goaziou <n.goaziou@gmail.com>
Subject: Re: table export to same buffer
Date: Mon, 12 Aug 2013 13:20:27 -0500	[thread overview]
Message-ID: <CAKchnZMCf6s_dwDA88cju3w2+0bX4vz=MVMoURop08bBy2isiw@mail.gmail.com> (raw)
In-Reply-To: <CAJ+TeoevFmiQAxG4Ws=Q2h4PeRP=QJnndAutM5iL8+W1AqDnYw@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2013 bytes --]

Hi Rustom

Sorry for the delay - I only check the list sporadically…

On Sun, Aug 4, 2013 at 6:13 AM, Rustom Mody <rustompmody@gmail.com> wrote:

>
>
> On Sun, Aug 4, 2013 at 5:04 AM, William Henney <whenney@gmail.com> wrote:
>
>>
>> On Fri, Aug 2, 2013 at 11:52 PM, Rustom Mody <rustompmody@gmail.com>wrote:
>>
>>>
>>>
[Snip]


> I dont think so.
>>> The context is writing C with C mode (or haskell with haskell-mode
>>> python with python-mode etc) ie the user is not using orgmode.  That is why
>>> I mentioned orgtbl, ie org table editing facilities are needed but the
>>> major mode is something else.
>>>
>>
>> What about a radio table using orgtbl-to-generic?
>>
>> See Appendix 6 of the Org manual
>>
>> Will
>>
>
> This looks like a useful approach
>
> The variable names dont seem to match:
> Appendix 6.2 talks of orgtbl-radio-tables
> However org (8.0.7) seems to have orgtbl-radio-table-templates
>
>

> Assuming they are the same, anywhere I can read about the documentation of
> the template format?
> Specifically I find that the name of the receiving function
> (orgtbl-to-latex) seems to have a significance.  The same in the template
> seems to have none
>
>
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




-- 

  Dr William Henney, Centro de Radioastronomía y Astrofísica,
  Universidad Nacional Autónoma de México, Campus Morelia

[-- Attachment #1.2: Type: text/html, Size: 4141 bytes --]

[-- Attachment #2: orgtbl-test.c --]
[-- Type: text/x-csrc, Size: 693 bytes --]

/* -*- eval: (orgtbl-mode); -*- */

/*
#+ORGTBL: SEND mytable orgtbl-to-generic :lstart "    const float " :sep " = " :skip 1 :lend ";" :skipcols (2 3)
| 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-u C-c C-c" will update formulae and install into C source

*/
void main() {
// BEGIN RECEIVE ORGTBL mytable
    const float a = 1.00000;
    const float b = 2.00000;
    const float c = -0.13333;
// END RECEIVE ORGTBL mytable
}



      reply	other threads:[~2013-08-12 18:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-02 17:23 table export to same buffer Rustom Mody
2013-08-02 19:22 ` Sebastien Vauban
2013-08-03  4:52 ` Rustom Mody
2013-08-03  7:25   ` Nicolas Goaziou
2013-08-03  8:06   ` Thorsten Jolitz
2013-08-03 23:34   ` William Henney
2013-08-04 11:13     ` Rustom Mody
2013-08-12 18:20       ` William Henney [this message]

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='CAKchnZMCf6s_dwDA88cju3w2+0bX4vz=MVMoURop08bBy2isiw@mail.gmail.com' \
    --to=whenney@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=n.goaziou@gmail.com \
    --cc=rustompmody@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).