From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: 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 Date: Mon, 9 Nov 2015 12:56:03 -0800 Message-ID: References: <2a1b8832412e49b7a0a4d231c3e289cf@exchsrv2.sgc.loc> <87mvusob7j.fsf@nicolasgoaziou.fr>, <3333fb4a-6541-4b80-b1b4-e7f6ff80ee83@email.android.com> <39f0e21eec95434b95514837a7ccb71f@exchsrv2.sgc.loc> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43583) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZvtUC-00029o-S9 for emacs-orgmode@gnu.org; Mon, 09 Nov 2015 15:56:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZvtU9-0008Fp-Gd for emacs-orgmode@gnu.org; Mon, 09 Nov 2015 15:56:20 -0500 Received: from iport-acv1-out.ucsd.edu ([132.239.0.176]:62923) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZvtU9-0008Eu-3M for emacs-orgmode@gnu.org; Mon, 09 Nov 2015 15:56:17 -0500 In-Reply-To: <39f0e21eec95434b95514837a7ccb71f@exchsrv2.sgc.loc> 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: "Cook, Malcolm" Cc: "emacs-orgmode@gnu.org" 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: > > [snip] > 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.e. `b<-"asdf"`) 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 <> 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 > results block. 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 colorized code. In *.Rhtml you get source code blocks colored per
and results blocks uncolored per
. Using *.org via ox-ravel --> *.Rhtml via knitr --> *.html will get you that far. Maybe customizing the classes to your taste will finish it. Best, Chuck p.s. If you go with ox-ravel, I recommend the ravel-lang branch: https://github.com/chasberry/orgmode-accessories/tree/ravel-lang