From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rustom Mody Subject: Re: Bug: Revert orgtbl-create-or-convert-from-region [6.33x] Date: Tue, 6 Aug 2013 10:58:03 +0530 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b417b4995ccde04e340b1ff Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36818) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6Zoo-0004jd-CY for emacs-orgmode@gnu.org; Tue, 06 Aug 2013 01:28:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V6Zom-0002mU-N9 for emacs-orgmode@gnu.org; Tue, 06 Aug 2013 01:28:26 -0400 Received: from mail-ob0-x232.google.com ([2607:f8b0:4003:c01::232]:57824) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6Zom-0002mI-Hh for emacs-orgmode@gnu.org; Tue, 06 Aug 2013 01:28:24 -0400 Received: by mail-ob0-f178.google.com with SMTP id ef5so7527103obb.9 for ; Mon, 05 Aug 2013 22:28:23 -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: emacs-orgmode --047d7b417b4995ccde04e340b1ff Content-Type: text/plain; charset=ISO-8859-1 I was writing up what I could make out of having program-files with inline tables. The example is done for python. It is exactly what the OP wants but close enough so giving it here. This file shows two approaches for making python data structures from orgtbl with both sender and receiver in same file. The first table is made with single line comments The second table is made using python's triple-quote feature The third is the recipient for both/either of the above To try out orgtbl minor mode needs to be active after python mode is active. Also it does not quite work for org 6.33 --------------------------- For the first use M-x orgtbl-toggle-comment followed by C-c C-c (inside the table) to send to recipient, followed by another M-x orgtbl-toggle-comment For the second only C-c C-c in the sender table is sufficient ------------------------------------cut here ------------------------------------ # #+ORGTBL: SEND marks orgtbl-to-generic :sep "," # | abe | 1 | 2 | 3 | 4 | 10 | # | beth | 3 | 1 | 5 | 7 | 16 | # | cathy | 5 | 6 | 7 | 5 | 23 | # #+TBLFM: $6=$2+$3+$4+$5 orig_table = """ #+ORGTBL: SEND marks orgtbl-to-generic :lfmt " \"%s\": [%s,%s,%s,%s,%s]," :llfmt " \"%s\": [%s,%s,%s,%s,%s]" | abe | 1 | 2 | 3 | 4 | 10 | | beth | 9 | 1 | 5 | 9 | 24 | | cathy | 5 | 6 | 7 | 5 | 23 | #+TBLFM: $6=$2+$3+$4+$5 """ stud_db = { # BEGIN RECEIVE ORGTBL marks abe,1,2,3,4,10 beth,3,1,5,7,16 cathy,5,6,7,5,23 # END RECEIVE ORGTBL marks } ----------------------- cut here ----------------------------- -- http://www.the-magus.in http://blog.languager.org --047d7b417b4995ccde04e340b1ff Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I was writing up what I could make out of having program-files with inline = tables.
The example is done for python.=A0 It is exactly what the OP wan= ts but close enough so giving it here.
This file shows two approaches fo= r making python data structures from orgtbl with both sender and receiver i= n same file.

The first table is made with single line comments
The second table i= s made using python's triple-quote feature
The third is the recipien= t for both/either of the above

To try out orgtbl minor mode needs to= be active after python mode is active.
Also it does not quite work for org 6.33
---------------------------
= For the first use M-x orgtbl-toggle-comment followed by C-c C-c (inside the table) to send to recipient, followed by another M-x=20 orgtbl-toggle-comment

For the second only C-c C-c in the sender tabl= e is sufficient


------------------------------------cut here ---= ---------------------------------
# #+ORGTBL: SEND marks orgtbl-to-gener= ic :sep ","
#=A0=A0 | abe=A0=A0 | 1 | 2 | 3 | 4 | 10 |
#=A0=A0 | beth=A0 | 3 | 1 | 5= | 7 | 16 |
#=A0=A0 | cathy | 5 | 6 | 7 | 5 | 23 |
# #+TBLFM: $6=3D$2= +$3+$4+$5


orig_table =3D """

#+ORGTBL: SEN= D marks orgtbl-to-generic :lfmt "=A0 \"%s\": [%s,%s,%s,%s,%s= ]," :llfmt "=A0 \"%s\": [%s,%s,%s,%s,%s]"
=A0 | abe=A0=A0 | 1 | 2 | 3 | 4 | 10 |
=A0 | beth=A0 | 9 | 1 | 5 | 9 | 2= 4 |
=A0 | cathy | 5 | 6 | 7 | 5 | 23 |
#+TBLFM: $6=3D$2+$3+$4+$5
&= quot;""

stud_db =3D {
# BEGIN RECEIVE ORGTBL marks
a= be,1,2,3,4,10
beth,3,1,5,7,16
cathy,5,6,7,5,23
# END RECEIVE ORGTBL marks
}
<= br>----------------------- cut here -----------------------------


--
http://www.the-magus.in
http://blog.languag= er.org

--047d7b417b4995ccde04e340b1ff--