mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-29 20:37:51 +00:00
ob-python: Fix discrepancy of single/multi-line code blocks
* lisp/ob-python.el (org-babel-python-evaluate-session): Fix discrepancy between how single-line and multiline code blocks return output. For example, before this commit, the 2 blocks behaved differently: +begin_src python :session :results output pass "foo" +end_src +RESULTS: +begin_src python :session :results output "foo" +end_src +RESULTS: : 'foo' But now, they both behave as the former.
This commit is contained in:
parent
66537267eb
commit
30a50d1c0f
|
@ -330,14 +330,12 @@ last statement in BODY, as elisp."
|
||||||
(results
|
(results
|
||||||
(pcase result-type
|
(pcase result-type
|
||||||
(`output
|
(`output
|
||||||
(let ((body (if (string-match-p ".\n+." body) ; Multiline
|
(let ((body (let ((tmp-src-file (org-babel-temp-file
|
||||||
(let ((tmp-src-file (org-babel-temp-file
|
|
||||||
"python-")))
|
"python-")))
|
||||||
(with-temp-file tmp-src-file (insert body))
|
(with-temp-file tmp-src-file (insert body))
|
||||||
(format org-babel-python--exec-tmpfile
|
(format org-babel-python--exec-tmpfile
|
||||||
(org-babel-process-file-name
|
(org-babel-process-file-name
|
||||||
tmp-src-file 'noquote)))
|
tmp-src-file 'noquote)))))
|
||||||
body)))
|
|
||||||
(mapconcat
|
(mapconcat
|
||||||
#'org-trim
|
#'org-trim
|
||||||
(butlast
|
(butlast
|
||||||
|
|
Loading…
Reference in a new issue