From 27aa7b3f1eac4dc5b93218956c5f949e73f23e55 Mon Sep 17 00:00:00 2001 From: Charles Berry Date: Sat, 7 Nov 2015 13:23:36 -0800 Subject: [PATCH] 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. --- lisp/ob-R.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/ob-R.el b/lisp/ob-R.el index 7c9b02426..f72cd9539 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)