From 3e1f111c3b862ebe7394377dd1d2c2b60a261c99 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Tue, 3 Apr 2018 21:27:59 +0200 Subject: [PATCH] ob-python: Small refactoring * lisp/ob-python.el (org-babel-python-evaluate-session): Small refactoring. --- lisp/ob-python.el | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lisp/ob-python.el b/lisp/ob-python.el index 13997c1a0..a44e5a518 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 -- 2.11.4.GIT