ob-python: Small refactoring

* lisp/ob-python.el (org-babel-python-evaluate-session): Small
  refactoring.
This commit is contained in:
Nicolas Goaziou 2018-04-03 21:27:59 +02:00
parent 1966d58b25
commit 3e1f111c3b
1 changed files with 13 additions and 13 deletions

View File

@ -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