[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] R code block produces only partial output
From: |
Charles C. Berry |
Subject: |
Re: [O] R code block produces only partial output |
Date: |
Tue, 5 Aug 2014 19:21:44 -0700 |
User-agent: |
Alpine 2.00 (OSX 1167 2008-08-23) |
On Tue, 5 Aug 2014, Andreas Kiermeier wrote:
On 6 August 2014 03:35, Charles Berry <address@hidden> 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
- Re: [O] R code block produces only partial output, (continued)
- Re: [O] R code block produces only partial output, Achim Gratz, 2014/08/19
- Re: [O] R code block produces only partial output, Aaron Ecay, 2014/08/23
- Re: [O] R code block produces only partial output, Andreas Kiermeier, 2014/08/23
- Re: [O] R code block produces only partial output, Aaron Ecay, 2014/08/23
- Re: [O] R code block produces only partial output, Thomas S. Dye, 2014/08/23
- Re: [O] R code block produces only partial output, Ista Zahn, 2014/08/23
- Re: [O] R code block produces only partial output, Charles C. Berry, 2014/08/23
- Re: [O] R code block produces only partial output, Aaron Ecay, 2014/08/28
- Re: [O] R code block produces only partial output, Rainer M Krug, 2014/08/09
- Re: [O] R code block produces only partial output, Andreas Kiermeier, 2014/08/05
- Re: [O] R code block produces only partial output,
Charles C. Berry <=
- Re: [O] R code block produces only partial output, Aaron Ecay, 2014/08/05
- Re: [O] R code block produces only partial output, Charles C. Berry, 2014/08/06