فهرست منبع

ob-python: Small refactoring

* lisp/ob-python.el (org-babel-python-evaluate-session): Small
  refactoring.
Nicolas Goaziou 7 سال پیش
والد
کامیت
3e1f111c3b
1فایلهای تغییر یافته به همراه13 افزوده شده و 13 حذف شده
  1. 13 13
      lisp/ob-python.el

+ 13 - 13
lisp/ob-python.el

@@ -310,19 +310,19 @@ last statement in BODY, as elisp."
                                                           'noquote)))))))
 	 (last-indent 0)
 	 (input-body (lambda (body)
-		       (mapc (lambda (line)
-			       ;; Insert a blank line to end an indent block.
-			       (let ((curr-indent (string-match "[^\s]" line)))
-				 (if curr-indent
-				     (progn
-				       (when (< curr-indent last-indent)
-					 (insert "")
-					 (funcall send-wait))
-				       (setq last-indent curr-indent))
-				   (setq last-indent 0)))
-			       (insert line)
-			       (funcall send-wait))
-			     (split-string body "[\r\n]"))
+		       (dolist (line (split-string body "[\r\n]"))
+			 ;; Insert a blank line to end an indent
+			 ;; block.
+			 (let ((curr-indent (string-match "\\S-" line)))
+			   (if curr-indent
+			       (progn
+				 (when (< curr-indent last-indent)
+				   (insert "")
+				   (funcall send-wait))
+				 (setq last-indent curr-indent))
+			     (setq last-indent 0)))
+			 (insert line)
+			 (funcall send-wait))
 		       (funcall send-wait)))
          (results
           (pcase result-type