On Tue, 5 Aug 2014, Andreas Kiermeier wrote: > ​ > On 6 August 2014 03:35, Charles Berry wrote: > ​[snip]​ > >> org-babel-R-evaluate-session uses >> >> (string-match "^\\([ ]*[>+\\.][ ]?\\)+\\([[0-9]+\\|[ ]\\)" line) >> >> to find the start of R output in the session. >> [snip] > ​ > Thanks Charles for finding this. > > I do use R quite a bit, and I can only think of "> > ​ ​ > " (at beginning of the line) as the command prompt, along with "+ > ​ ​ > " (at beginning of the line) as a continuation prompt for multi-line > commands. I don't know what > ​ ​ > "\" or > ​ ​ > "." provide > ​ (I don't think this has changed over the various R versions)​ > > ​. > > ​A ​ > complication might be that the user can change the command prompt (and > continuation prompt) to something else they like ( > ​see here: ​ > http://cran.r-project.org/doc/manuals/r-release/R-intro.html#Customizing-the-environment > ​)​. > > ​For the time being I've taken the "\\." out of my local version of ob-R.el > (then byte compiled and loaded) and it seems to work fine. > > ​Maybe this is a question for the ESS developers who use R extensively and > probably might be able to provide some more definitive guidance on this > than I can? Here is the docstring from ESS's inferior-S-prompt: inferior-S-prompt is a variable defined in `ess-custom.el'. Its value is "[]a-zA-Z0-9.[]*\\([>+.] \\)*> " Documentation: Regexp used in S and R inferior and transcript buffers for prompt navigation. Customise it to make `comint-previous-prompt' quiqly navigate to interesting portions of the buffer. You can customize this variable. ---- Note that there is a space *required* after the [>+.], but the hard coded regex in `org-babel-R-evaluate-session' lets the space be optional. I am guessing the a-zA-Z stuff is there to strip 'Browse[1]> ' prompts and such, which probably isn't an issue for babel. Just before the defcustom for inferior-S-prompt, I see this comment in ess-custom.el: ;; need to recognise + + + > > > ;; and "+ . + " in tracebug prompt Ha! The '.' seems to be for ess-tracebug. I am guessing that nobody will need to output tracebug sessions from babel. So maybe it is safe to delete the "." after all - or at least require the space after it. Maybe the regex should be put in a defcustom. p.s. There is also `inferior-ess-prompt' which on my system is the same as inferior-S-prompt (in an R buffer - its buffer local) HTH, Chuck