emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Bug: Revert orgtbl-create-or-convert-from-region [6.33x]


From: Rustom Mody
Subject: Re: [O] Bug: Revert orgtbl-create-or-convert-from-region [6.33x]
Date: Tue, 6 Aug 2013 10:58:03 +0530

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]