Browse Source

Merge branch 'master' of git+ssh://repo.or.cz/srv/git/org-mode

Carsten Dominik 15 years ago
parent
commit
63c49bcaed
2 changed files with 12 additions and 4 deletions
  1. 9 3
      contrib/babel/lisp/langs/org-babel-R.el
  2. 3 1
      contrib/babel/lisp/org-babel-tangle.el

+ 9 - 3
contrib/babel/lisp/langs/org-babel-R.el

@@ -59,8 +59,14 @@ called by `org-babel-execute-src-block'."
 (defun org-babel-prep-session:R (session params)
   "Prepare SESSION according to the header arguments specified in PARAMS."
   (let* ((session (org-babel-R-initiate-session session params))
-         (vars (org-babel-ref-variables params)))
-    (mapc (lambda (pair) (org-babel-R-assign-elisp session (car pair) (cdr pair))) vars)
+	 (vars (org-babel-ref-variables params))
+	 (var-lines
+	  (mapcar
+	   (lambda (pair) (org-babel-R-assign-elisp (car pair) (cdr pair))) vars)))
+    (org-babel-comint-in-buffer session
+      (mapc (lambda (var)
+              (move-end-of-line 1) (insert var) (comint-send-input nil t)
+              (org-babel-comint-wait-for-output session)) var-lines))
     session))
 
 (defun org-babel-load-session:R (session body params)
@@ -81,7 +87,7 @@ called by `org-babel-execute-src-block'."
     (format "%S" s)))
 
 (defun org-babel-R-assign-elisp (name value)
-  "Read the elisp VALUE into a variable named NAME."
+  "Construct R code assigning the elisp VALUE to a variable named NAME."
   (if (listp value)
       (let ((transition-file (make-temp-file "org-babel-R-import")))
         ;; ensure VALUE has an orgtbl structure (depth of at least 2)

+ 3 - 1
contrib/babel/lisp/org-babel-tangle.el

@@ -172,8 +172,10 @@ code blocks by language."
              (source-name (intern (or (fifth info)
                                       (format "block-%d" block-counter))))
              (src-lang (first info))
-             (body (org-babel-expand-noweb-references info))
              (params (third info))
+	     (body (if (equal "no" (cdr (assoc :noweb params)))
+		       (second info)
+		     (org-babel-expand-noweb-references info)))
              (spec (list link source-name params body (third (cdr (assoc src-lang org-babel-tangle-langs)))))
              by-lang)
         (unless (string= (cdr (assoc :tangle params)) "no") ;; maybe skip