summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Berry <ccberry@ucsd.edu>2015-11-07 13:23:36 -0800
committerCharles Berry <ccberry@ucsd.edu>2015-11-07 13:26:11 -0800
commit27aa7b3f1eac4dc5b93218956c5f949e73f23e55 (patch)
tree190a0a56fe7d220b83a87b0d8e7534fce158265e
parent635aae391788e172d3805025bdedfeb3746ebfb3 (diff)
downloadorg-mode-27aa7b3f1eac4dc5b93218956c5f949e73f23e55.tar.gz
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.
-rw-r--r--lisp/ob-R.el3
1 files changed, 2 insertions, 1 deletions
diff --git a/lisp/ob-R.el b/lisp/ob-R.el
index 7c9b024..f72cd95 100644
--- a/lisp/ob-R.el
+++ b/lisp/ob-R.el
@@ -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)