Browse Source

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.
Charles Berry 4 years ago
parent
commit
27aa7b3f1e
1 changed files with 2 additions and 1 deletions
  1. 2 1
      lisp/ob-R.el

+ 2 - 1
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)