Browse Source

ob-python: Send RET after every line w/session evaluation

* lisp/ob-python.el (org-babel-python-evaluate-session): Send
  comint-send-input after every line when interacting with an
  interactive python process.
Eric Schulte 14 years ago
parent
commit
56de599c00
1 changed files with 5 additions and 3 deletions
  1. 5 3
      lisp/ob-python.el

+ 5 - 3
lisp/ob-python.el

@@ -267,9 +267,11 @@ last statement in BODY, as elisp."
 	  (org-babel-comint-with-output
 	      (session org-babel-python-eoe-indicator t body)
 	    (let ((comint-process-echoes nil))
-	      (input-body body)
-	      (insert org-babel-python-eoe-indicator)
-	      (comint-send-input))) 2) "\n"))
+	      (mapc
+	       (lambda (line)
+		 (insert line) (comint-send-input nil t))
+	       (append (split-string body "[\n\r]") (list org-babel-python-eoe-indicator)))))
+	  2) "\n"))
        (value
 	(let ((tmp-file (org-babel-temp-file "python-")))
 	  (org-babel-comint-with-output