DONE Remove protective commas from # comments before evaluating

This commit is contained in:
Eric Schulte 2009-06-01 16:56:59 -07:00
parent 8fef1f0509
commit c38294d21f
2 changed files with 32 additions and 21 deletions

View file

@ -174,13 +174,13 @@ of the following form. (language body header-arguments-alist)"
(defun org-babel-parse-src-block-match ()
(list (org-babel-clean-text-properties (match-string 1))
(org-babel-clean-text-properties (match-string 4))
(org-babel-strip-protective-comas (org-babel-clean-text-properties (match-string 4)))
(org-combine-plists org-babel-default-header-args
(org-babel-parse-header-arguments (org-babel-clean-text-properties (or (match-string 3) ""))))))
(defun org-babel-parse-inline-src-block-match ()
(list (org-babel-clean-text-properties (match-string 1))
(org-babel-clean-text-properties (match-string 4))
(org-babel-strip-protective-comas (org-babel-clean-text-properties (match-string 4)))
(org-combine-plists org-babel-default-inline-header-args
(org-babel-parse-header-arguments (org-babel-clean-text-properties (or (match-string 3) ""))))))
@ -334,6 +334,10 @@ non-nil."
"Strip all properties from text return."
(set-text-properties 0 (length text) nil text) text)
(defun org-babel-strip-protective-comas (body)
"Strip protective comas from bodies of source blocks."
(replace-regexp-in-string "^,#" "#" body))
(defun org-babel-read (cell)
"Convert the string value of CELL to a number if appropriate.
Otherwise if cell looks like a list (meaning it starts with a

View file

@ -114,7 +114,7 @@ table, allowing the test suite to be run be evaluation of the table
and the results to be collected in the same table.
* Tasks [21/35]
* Tasks [22/35]
** TODO Create objects in top level (global) environment in R?
*** initial requirement statement [DED]
At the moment, objects created by computations performed in the
@ -386,10 +386,6 @@ tabel
Another example is in the [[*operations%20in%20on%20tables][grades example]].
** TODO Remove protective commas from # comments before evaluating
org inserts protective commas in front of ## comments in language
modes that use them. We need to remove them prior to sending code
to the interpreter.
** PROPOSED conversion between org-babel and noweb (e.g. .Rnw) format
I haven't thought about this properly. Just noting it down. What
Sweave uses is called "R noweb" (.Rnw).
@ -444,20 +440,6 @@ one that comes to mind is the ability to treat a source-code block
like a function which accepts arguments and returns results. Actually
this can be it's own TODO (see [[* source blocks as functions][source blocks as functions]]).
** DONE pass multiple reference arguments into R
Can we do this? I wasn't sure how to supply multiple 'var' header
args. Just delete this if I'm being dense.
This should be working, see the following example...
#+srcname: two-arg-example
#+begin_src R :var n=2 :var m=8
n + m
#+end_src
#+resname: two-arg-example
: 10
** DEFERRED use textConnection to pass tsv to R?
When passing args from the org buffer to R, the following route is
used: arg in buffer -> elisp -> tsv on file -> data frame in R. I
@ -610,6 +592,31 @@ to the command if BUFF is not given.)
posterity. Same for a shell session either in a *shell* buffer, or
pasted from another terminal emulator. And python of course.
** DONE Remove protective commas from # comments before evaluating
org inserts protective commas in front of ## comments in language
modes that use them. We need to remove them prior to sending code
to the interpreter.
#+srcname: testing-removal-of-protective-comas
#+begin_src ruby
,# this one might break it??
:comma_protection
#+end_src
** DONE pass multiple reference arguments into R
Can we do this? I wasn't sure how to supply multiple 'var' header
args. Just delete this if I'm being dense.
This should be working, see the following example...
#+srcname: two-arg-example
#+begin_src R :var n=2 :var m=8
n + m
#+end_src
#+resname: two-arg-example
: 10
** DONE ensure that table ranges work
when a table range is passed to org-babel as an argument, it should be
interpreted as a vector.