[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] BUG: emacs orgmode ob-R.el function org-babel-R-evaluate-session
Charles C. Berry
Re: [O] BUG: emacs orgmode ob-R.el function org-babel-R-evaluate-session over aggressively performs "; ; cleanup extra prompts left in output" and a possible workaround
Mon, 9 Nov 2015 12:56:03 -0800
Alpine 2.20 (OSX 67 2015-01-07)
On Mon, 9 Nov 2015, Cook, Malcolm wrote:
> > I've wondered if there is not a better way for Babel to share an
> > interactive session with the user. For instance, if we wanted to
> > support a new form of results processing on addition to value and
> > output.... Namely, "transcript", wherein the results of evaluating a
> > source block would be a transcript of the season with statements
> > interwoven with their respective outputs.... I suspect that this would
> > not be easy extension of the current approach since it would require
> > parsing the source into statements that get evaluated sequentially with
> > visible results echoed into the transcript.
> You can do stuff like this using babel and some R code.
> Here is a start:
Sourcing a textConnection on a :noweb interpolated block will not
handle embedded quotes in the source block correctly. Adding an
assignment of a string to a variable in my-block reveals this
I know. That is why I said it is a 'start'. You can work around this
with more Babel if that is the only issue. Write a src block `good-fmt'
that will render the body of another block as you want it and then use
<<good-fmt("R-src-blk-with-quotes")>> to insert it.
Nor does it extend to my underspecified conception of what
:transcript output would be. I intended that :transcript would
generate a colorized source blocks separated by results for
statements which generated visible results. You implementation makes
the source and results undifferentiated. My mistake for
underspecifying my intention. I think I might be able to cobble what
I want using the 'evaluate' package
(https://cran.rstudio.com/web/packages/evaluate/evaluate.pdf) with an
output handler to format source as an R code block and results as R
See Aaron Ecay's patches from around 08/2014. And discussions on this
list from about that time. He had some of this working, but there
were some issues about handling remote calls, IIRC.
Probably not worth the effort. Or rather, probably
already done within the knitr/rmarkdown.
By default knitr interlaces the code and output in a frame with
the output lines prefixed by '##'. The code is highlighted by default.
In *.Rnw this leads to a single block with a background color and
In *.Rhtml you get source code blocks colored per <div class="source">
and results blocks uncolored per <div class="output">.
Using *.org via ox-ravel --> *.Rhtml via knitr --> *.html will get you
Maybe customizing the classes to your taste will finish it.
p.s. If you go with ox-ravel, I recommend the ravel-lang branch: