0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-29 18:36:26 +00:00

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

View file

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