|
|
@@ -3,8 +3,18 @@
|
|
|
#+SEQ_TODO: TODO OPEN PROPOSED | DONE RESOLVED REJECTED
|
|
|
#+STARTUP: oddeven
|
|
|
|
|
|
-* Tasks [8/16]
|
|
|
-
|
|
|
+* Tasks [8/18]
|
|
|
+
|
|
|
+** PROPOSED re-implement R evaluation using ess-command or ess-execute
|
|
|
+ I can't see anything wrong with the current R evaluation code or
|
|
|
+ behaviour, but I think it would be good to use the ESS functions
|
|
|
+ from a political point of view. Plus of course it has the normal
|
|
|
+ benefits of an API (insulates us from any underlying changes etc). [DED]
|
|
|
+** PROPOSED make C-c C-c work anywhere within source code block?
|
|
|
+ This seems like it would be nice to me, but perhaps it would be
|
|
|
+ inefficient or ugly in implementation? I suppose you could search
|
|
|
+ forward, and if you find #+end_src before you find #+begin_src,
|
|
|
+ then you're inside one. [DED]
|
|
|
** TODO share litorgy
|
|
|
how should we share litorgy?
|
|
|
|
|
|
@@ -312,8 +322,24 @@ This is currently working only with emacs lisp as in the following
|
|
|
example in the [[* emacs lisp source reference][emacs lisp source reference]].
|
|
|
|
|
|
|
|
|
-* Bugs [5/5]
|
|
|
+* Bugs [5/7]
|
|
|
|
|
|
+** TODO with :results replace, non-table output doesn't replace table output
|
|
|
+ And vice versa. E.g. Try this first with table and then with len(table) [DED]
|
|
|
+#+begin_src python :var table=sandbox :results replace
|
|
|
+table
|
|
|
+#+end_src
|
|
|
+
|
|
|
+| 1 | 2 | 3 |
|
|
|
+| 4 | "schulte" | 6 |
|
|
|
+: 2
|
|
|
+
|
|
|
+
|
|
|
+** TODO org bug/request: prevent certain org behaviour within code blocks
|
|
|
+ E.g. [[]] gets recognised as a link (when there's text inside the
|
|
|
+ brackets). This is bad for R code at least, and more generally
|
|
|
+ could be argued to be inappropriate. Is it difficult to get org to
|
|
|
+ ignore text in code blocks? [DED]
|
|
|
** DONE extra quotes for nested string
|
|
|
Well R appears to be reading the tables without issue...
|
|
|
|
|
|
@@ -566,13 +592,13 @@ To run these examples evaluate [[file:litorgy/litorgy-init.el][litorgy-init.el]]
|
|
|
date
|
|
|
#+end_src
|
|
|
|
|
|
-: Sun Apr 5 10:10:05 PDT 2009
|
|
|
+: Thu May 14 18:52:25 EDT 2009
|
|
|
|
|
|
#+begin_src ruby
|
|
|
Time.now
|
|
|
#+end_src
|
|
|
|
|
|
-: Sat May 09 18:18:33 -0700 2009
|
|
|
+: Thu May 14 18:59:09 -0400 2009
|
|
|
|
|
|
#+begin_src python
|
|
|
"Hello World"
|
|
|
@@ -585,11 +611,11 @@ Time.now
|
|
|
|
|
|
#+begin_src R :results replace
|
|
|
a <- 9
|
|
|
-b <- 17
|
|
|
+b <- 14
|
|
|
a + b
|
|
|
#+end_src
|
|
|
|
|
|
-: 26
|
|
|
+: 23
|
|
|
|
|
|
#+begin_src R
|
|
|
hist(rgamma(20,3,3))
|
|
|
@@ -604,8 +630,8 @@ of the source code block into an org table. It's using the classic
|
|
|
out...
|
|
|
|
|
|
1. evaluate [[file:litorgy/init.el]] to load litorgy and friends
|
|
|
-2. evaluate the transpose definition =\C-u \C-c\C-c= on the beginning of
|
|
|
- the source block (prefix arg to inhibit output)
|
|
|
+2. evaluate the transpose definition =\C-c\C-c= on the beginning of
|
|
|
+ the source block
|
|
|
3. evaluate the next source code block, this should read in the table
|
|
|
because of the =:var table=previous=, then transpose the table, and
|
|
|
finally it should insert the transposed table into the buffer
|
|
|
@@ -618,6 +644,7 @@ out...
|
|
|
(apply #'mapcar* #'list table))
|
|
|
#+end_src
|
|
|
|
|
|
+
|
|
|
#+TBLNAME: sandbox
|
|
|
| 1 | 2 | 3 |
|
|
|
| 4 | schulte | 6 |
|
|
|
@@ -626,9 +653,6 @@ out...
|
|
|
(transpose table)
|
|
|
#+end_src
|
|
|
|
|
|
-| 1 | 4 |
|
|
|
-| 2 | "schulte" |
|
|
|
-| 3 | 6 |
|
|
|
|
|
|
#+begin_src emacs-lisp
|
|
|
'(1 2 3 4 5)
|
|
|
@@ -658,11 +682,12 @@ table
|
|
|
| 4 | "schulte" | 6 |
|
|
|
|
|
|
#+begin_src python :var table=sandbox :results replace
|
|
|
-table
|
|
|
+len(table)
|
|
|
#+end_src
|
|
|
|
|
|
-| 1 | 2 | 3 |
|
|
|
-| 4 | "schulte" | 6 |
|
|
|
+: 2
|
|
|
+
|
|
|
+| "__add__" | "__class__" | "__contains__" | "__delattr__" | "__delitem__" | "__delslice__" | "__doc__" | "__eq__" | "__format__" | "__ge__" | "__getattribute__" | "__getitem__" | "__getslice__" | "__gt__" | "__hash__" | "__iadd__" | "__imul__" | "__init__" | "__iter__" | "__le__" | "__len__" | "__lt__" | "__mul__" | "__ne__" | "__new__" | "__reduce__" | "__reduce_ex__" | "__repr__" | "__reversed__" | "__rmul__" | "__setattr__" | "__setitem__" | "__setslice__" | "__sizeof__" | "__str__" | "__subclasshook__" | "append" | "count" | "extend" | "index" | "insert" | "pop" | "remove" | "reverse" | "sort" |
|
|
|
|
|
|
*** (sandbox table) R
|
|
|
|
|
|
@@ -675,6 +700,26 @@ x <- c(rnorm(10, mean=-3, sd=1), rnorm(10, mean=3, sd=1))
|
|
|
x
|
|
|
#+end_src
|
|
|
|
|
|
+| -3.35473133869346 |
|
|
|
+| -2.45714878661 |
|
|
|
+| -3.32819924928633 |
|
|
|
+| -2.97310212756194 |
|
|
|
+| -2.09640758369576 |
|
|
|
+| -5.06054014378736 |
|
|
|
+| -2.20713700711221 |
|
|
|
+| -1.37618039712037 |
|
|
|
+| -1.95839385821742 |
|
|
|
+| -3.90407396475502 |
|
|
|
+| 2.51168071590226 |
|
|
|
+| 3.96753011570494 |
|
|
|
+| 3.31793212627865 |
|
|
|
+| 1.99829753972341 |
|
|
|
+| 4.00403686419829 |
|
|
|
+| 4.63723764452927 |
|
|
|
+| 3.94636744261313 |
|
|
|
+| 3.58355906547775 |
|
|
|
+| 3.01563442274226 |
|
|
|
+| 1.7634976849927 |
|
|
|
#+begin_src R var tabel=sandbox_r :results replace
|
|
|
tabel
|
|
|
#+end_src
|
|
|
@@ -691,16 +736,18 @@ they are imported as org-mode tables...
|
|
|
ls -l
|
|
|
#+end_src
|
|
|
|
|
|
-| "total" | 224 | "" | "" | "" | "" | "" | "" | "" |
|
|
|
-| "-rw-r--r--" | 1 | "eschulte" | "staff" | 35147 | "Apr" | 15 | 14 | "COPYING" |
|
|
|
-| "-rw-r--r--" | 1 | "eschulte" | "staff" | 277 | "Apr" | 15 | 14 | "README.markdown" |
|
|
|
-| "-rw-r--r--" | 1 | "eschulte" | "staff" | 57 | "Apr" | 15 | 14 | "block" |
|
|
|
-| "drwxr-xr-x" | 6 | "eschulte" | "staff" | 204 | "Apr" | 15 | 14 | "existing_tools" |
|
|
|
-| "drwxr-xr-x" | 12 | "eschulte" | "staff" | 408 | "May" | 9 | 18 | "litorgy" |
|
|
|
-| "-rw-r--r--" | 1 | "eschulte" | "staff" | 790 | "May" | 6 | 6 | "litorgy.org" |
|
|
|
-| "-rw-r--r--" | 1 | "eschulte" | "staff" | 49904 | "May" | 9 | 18 | "rorg.org" |
|
|
|
-| "-rw-r--r--" | 1 | "eschulte" | "staff" | 5469 | "Apr" | 26 | 13 | "test-export.html" |
|
|
|
-| "-rw-r--r--" | 1 | "eschulte" | "staff" | 972 | "Apr" | 26 | 13 | "test-export.org" |
|
|
|
+| "total" | 208 | "" | "" | "" | "" | "" | "" |
|
|
|
+| "-rw-r--r--" | 1 | "dan" | "dan" | 57 | 2009 | 15 | "block" |
|
|
|
+| "-rw-r--r--" | 1 | "dan" | "dan" | 35147 | 2009 | 15 | "COPYING" |
|
|
|
+| "-rw-r--r--" | 1 | "dan" | "dan" | 722 | 2009 | 18 | "examples.org" |
|
|
|
+| "drwxr-xr-x" | 4 | "dan" | "dan" | 4096 | 2009 | 19 | "existing_tools" |
|
|
|
+| "-rw-r--r--" | 1 | "dan" | "dan" | 2207 | 2009 | 14 | "intro.org" |
|
|
|
+| "drwxr-xr-x" | 2 | "dan" | "dan" | 4096 | 2009 | 18 | "litorgy" |
|
|
|
+| "-rw-r--r--" | 1 | "dan" | "dan" | 277 | 2009 | 20 | "README.markdown" |
|
|
|
+| "-rw-r--r--" | 1 | "dan" | "dan" | 11837 | 2009 | 18 | "rorg.html" |
|
|
|
+| "-rw-r--r--" | 1 | "dan" | "dan" | 61829 | 2009 | 19 | "#rorg.org#" |
|
|
|
+| "-rw-r--r--" | 1 | "dan" | "dan" | 60190 | 2009 | 19 | "rorg.org" |
|
|
|
+| "-rw-r--r--" | 1 | "dan" | "dan" | 972 | 2009 | 11 | "test-export.org" |
|
|
|
|
|
|
|
|
|
** silent evaluation
|
|
|
@@ -709,14 +756,18 @@ ls -l
|
|
|
:im_the_results
|
|
|
#+end_src
|
|
|
|
|
|
+: :im_the_results
|
|
|
+
|
|
|
#+begin_src ruby :results silent
|
|
|
:im_the_results
|
|
|
#+end_src
|
|
|
|
|
|
#+begin_src ruby :results replace
|
|
|
-:im_the_results
|
|
|
+:im_the_results_
|
|
|
#+end_src
|
|
|
|
|
|
+: :im_the_results_
|
|
|
+
|
|
|
|
|
|
** (sandbox) referencing other source blocks
|
|
|
Doing this in emacs-lisp first because it's trivial to convert
|
|
|
@@ -737,6 +788,8 @@ used in the calculations of the second source block.
|
|
|
(* first 3)
|
|
|
#+end_src
|
|
|
|
|
|
+: 18
|
|
|
+
|
|
|
This example is the same as the previous only the variable being
|
|
|
passed through is a table rather than a number.
|
|
|
|
|
|
@@ -758,6 +811,8 @@ passed through is a table rather than a number.
|
|
|
(transpose table)
|
|
|
#+end_src
|
|
|
|
|
|
+| 1 | 2 | 3 |
|
|
|
+| 4 | "schulte" | 6 |
|
|
|
*** ruby python
|
|
|
Now working for ruby
|
|
|
|
|
|
@@ -770,8 +825,6 @@ Now working for ruby
|
|
|
2 * other
|
|
|
#+end_src
|
|
|
|
|
|
-: 178
|
|
|
-
|
|
|
and for python
|
|
|
|
|
|
#+SRCNAME: start_two
|
|
|
@@ -783,8 +836,6 @@ and for python
|
|
|
another*3
|
|
|
#+end_src
|
|
|
|
|
|
-: 294
|
|
|
-
|
|
|
*** mixed languages
|
|
|
Since all variables are converted into Emacs Lisp it is no problem to
|
|
|
reference variables specified in another language.
|
|
|
@@ -842,20 +893,20 @@ inline source code blocks) [[file:test-export.org]]
|
|
|
|
|
|
: 15
|
|
|
|
|
|
-#+begin_src emacs-lisp :var result=triple(n=2, m=98) :results replace
|
|
|
+#+begin_src emacs-lisp :var result=triple(n=3, m=98) :results replace
|
|
|
result
|
|
|
#+end_src
|
|
|
|
|
|
-: 6
|
|
|
+: 294
|
|
|
|
|
|
The following just demonstrates the ability to assign variables to
|
|
|
literal values, which was not implemented until recently.
|
|
|
|
|
|
#+begin_src ruby :var num="eric" :results replace
|
|
|
-num+" schulte"
|
|
|
+num+" schulte "
|
|
|
#+end_src
|
|
|
|
|
|
-: "eric schulte"
|
|
|
+: "eric schulte "
|
|
|
|
|
|
|
|
|
** (sandbox) inline source blocks
|
|
|
@@ -874,7 +925,7 @@ arguments. src_ruby[:var n=fibbd( n = 0 )]{n}
|
|
|
#+end_src
|
|
|
|
|
|
#+srcname: fibbd
|
|
|
-#+begin_src emacs-lisp :var n=2 :results silent
|
|
|
+#+begin_src emacs-lisp :var n=4 :results silent
|
|
|
(fibbd n)
|
|
|
#+end_src
|
|
|
|
|
|
@@ -966,6 +1017,9 @@ should share this... I don't know if you guys use [[http://code.google.com/p/sma
|
|
|
but if you do you might find this [[file:block][block-snippet]] org-mode snippet
|
|
|
useful (I use it all the time).
|
|
|
|
|
|
+** Dan <2009-05-14 Thu 19:13>
|
|
|
+ 1. removed prefix arg [[2. evaluate the transpose definition =\C-c\C-c= on the beginning of][here]]
|
|
|
+ 2. added some tasks and bugs
|
|
|
|
|
|
* Overview
|
|
|
This project is basically about putting source code into org
|
|
|
@@ -1234,7 +1288,7 @@ internal to the source-code evaluation process?
|
|
|
|
|
|
#+begin_src emacs-lisp
|
|
|
'(:R-obj-name-1 tbl-name-or-id-1 :R-obj-name-2 tbl-name-or-id-2)
|
|
|
-#+end_src emacs-lisp
|
|
|
+#+end_src
|
|
|
|
|
|
As a result of passing that option, the code would be able to access
|
|
|
the data referenced by table-name-or-id-2 via read.table(R-obj-name-1).
|