summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2018-04-03 21:27:59 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2018-04-03 21:27:59 +0200
commit3e1f111c3b862ebe7394377dd1d2c2b60a261c99 (patch)
treeb6ad7187b057dc37b37540900b2145c96d65e37d
parent1966d58b253d0077025589c736b9223010682e17 (diff)
downloadorg-mode-3e1f111c3b862ebe7394377dd1d2c2b60a261c99.tar.gz
ob-python: Small refactoring
* lisp/ob-python.el (org-babel-python-evaluate-session): Small refactoring.
-rw-r--r--lisp/ob-python.el26
1 files changed, 13 insertions, 13 deletions
diff --git a/lisp/ob-python.el b/lisp/ob-python.el
index 13997c1..a44e5a5 100644
--- a/lisp/ob-python.el
+++ b/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