ob-R.el: org-babel-R-evaluate-session finds prompts more reliably

* lisp/ob-R.el (org-babel-R-evaluate-session) should find prompts more
  reliably.  First, the regular expression used requires spacing
  between and after instances of `[>+.]'.  Also, the search terminates
  at the first `\n', so complicated results with prompt like strings
  in them are not deleted.

Prompt finding is necessarily heuristic. It may be necessary to render
the regular expression with a defcustom as is done in ess-mode.
This commit is contained in:
Charles Berry 2015-11-07 13:23:36 -08:00
parent 635aae3917
commit 27aa7b3f1e
1 changed files with 2 additions and 1 deletions

View File

@ -444,7 +444,8 @@ last statement in BODY, as elisp."
(mapcar
(lambda (line) ;; cleanup extra prompts left in output
(if (string-match
"^\\([ ]*[>+\\.][ ]?\\)+\\([[0-9]+\\|[ ]\\)" line)
"^\\([>+.]\\([ ][>.+]\\)*[ ]\\)"
(car (split-string line "\n")))
(substring line (match-end 1))
line))
(org-babel-comint-with-output (session org-babel-R-eoe-output)