From b766b094a081cdd1c14465f02e4fc1ea2078a858 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Sun, 19 Jul 2009 18:03:33 -0400 Subject: [PATCH] Using temp function definition to tidy R evaluation code. --- lisp/langs/org-babel-R.el | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/lisp/langs/org-babel-R.el b/lisp/langs/org-babel-R.el index 0a023457..4e0b2a85 100644 --- a/lisp/langs/org-babel-R.el +++ b/lisp/langs/org-babel-R.el @@ -126,22 +126,21 @@ last statement in BODY, as elisp." (case result-type (value (org-babel-R-process-value-result (org-babel-import-elisp-from-file tmp-file) column-names-p)) - (output - (setq broke nil results - (delete - nil - (mapcar (lambda (el) - (if (or broke - (and (string-match (regexp-quote org-babel-R-eoe-output) el) - (setq broke t))) - nil - (if (= (length el) 0) - nil - (if (string-match comint-prompt-regexp el) - (substring el (match-end 0)) - el)))) - (mapcar #'org-babel-chomp raw)))) - (mapconcat #'identity results "\n"))))))) + (output + (flet ((extractor + (el) + (if (or broke + (and (string-match (regexp-quote org-babel-R-eoe-output) el) + (setq broke t))) + nil + (if (= (length el) 0) + nil + (if (string-match comint-prompt-regexp el) + (substring el (match-end 0)) + el))))) + (mapconcat + #'identity + (delete nil (mapcar #'extractor (mapcar #'org-babel-chomp raw))) "\n")))))))) (defun org-babel-R-process-value-result (result column-names-p) "R-specific processing of return value prior to return to org-babel. -- 2.11.4.GIT