summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2010-12-01 08:01:00 -0700
committerEric Schulte <schulte.eric@gmail.com>2010-12-01 08:01:00 -0700
commit8e746c9afa0874ea0f84d47bc10551cc58500877 (patch)
tree52cdc320c1b592d3b7ce5f6abd1e10b64bda7803
parent2c81a4c1420013a3b48e9ba85cb4a669fbb4912a (diff)
downloadorg-mode-8e746c9afa0874ea0f84d47bc10551cc58500877.tar.gz
ob: removing empty lines from R output
* lisp/ob-R.el (org-babel-R-evaluate-session): Removing empty lines from R session output, these are often the result of variable assignments.
-rw-r--r--lisp/ob-R.el22
1 files changed, 12 insertions, 10 deletions
diff --git a/lisp/ob-R.el b/lisp/ob-R.el
index 2be7992..8547234 100644
--- a/lisp/ob-R.el
+++ b/lisp/ob-R.el
@@ -276,16 +276,18 @@ last statement in BODY, as elisp."
(butlast
(delq nil
(mapcar
- (lambda (line) ;; cleanup extra prompts left in output
- (if (string-match
- "^\\([ ]*[>+][ ]?\\)+\\([[0-9]+\\|[ ]\\)" line)
- (substring line (match-end 1))
- line))
- (org-babel-comint-with-output (session org-babel-R-eoe-output)
- (insert (mapconcat #'org-babel-chomp
- (list body org-babel-R-eoe-indicator)
- "\n"))
- (inferior-ess-send-input)))) 2) "\n"))))
+ (lambda (line) (when (> (length line) 0) line))
+ (mapcar
+ (lambda (line) ;; cleanup extra prompts left in output
+ (if (string-match
+ "^\\([ ]*[>+][ ]?\\)+\\([[0-9]+\\|[ ]\\)" line)
+ (substring line (match-end 1))
+ line))
+ (org-babel-comint-with-output (session org-babel-R-eoe-output)
+ (insert (mapconcat #'org-babel-chomp
+ (list body org-babel-R-eoe-indicator)
+ "\n"))
+ (inferior-ess-send-input)))))) "\n"))))
(defun org-babel-R-process-value-result (result column-names-p)
"R-specific processing of return value.