From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: R code block produces only partial output Date: Tue, 5 Aug 2014 19:21:44 -0700 Message-ID: References: <87iom8zd24.fsf@gmail.com> <877g2oz9gv.fsf@gmail.com> Mime-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1027251939-1407291705=:1184" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59036) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEqrR-00085X-Rb for emacs-orgmode@gnu.org; Tue, 05 Aug 2014 22:21:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XEqrL-00022O-Tb for emacs-orgmode@gnu.org; Tue, 05 Aug 2014 22:21:53 -0400 Received: from iport-acv2-out.ucsd.edu ([132.239.0.174]:41476) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEqrL-00021v-Gq for emacs-orgmode@gnu.org; Tue, 05 Aug 2014 22:21:47 -0400 In-Reply-To: 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: Andreas Kiermeier Cc: emacs-orgmode@gnu.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1027251939-1407291705=:1184 Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT 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 --0-1027251939-1407291705=:1184--