Subject: bug#50514: 28.0.50; org inline call to python src block req C-g to break

From: Augusto Stoffel <[email-masked]>
Date: Sat, 11 Sep 2021 15:26:00 +0200

On Fri, 10 Sep 2021 at 23:06, "Barton, Mark" <[email-masked]> wrote:

> With the Test.org file below, if I C-c C-c on the call_file_date it will echo “Shell native completion is
> enabled” and Emacs will not respond until I hit C-g. If I immediately C-c C-c again, it will echo
> “Inline error: multiline result cannot be used” and Emacs responds normally to commands
> without C-g to break out. The problem is only when I use session in the property line. If I comment
> out the property line then it works. My original file uses dozens of python src blocks that require
> the session

Hi Mark,

does the patch below solve the problem for you?

If it does, then I know why it happens and I can suggest the Org people
a slightly more robust solution.

diff --git a/lisp/org/ob-python.el b/lisp/org/ob-python.el
index 7911205d08..e3714964b7 100644
--- a/lisp/org/ob-python.el
+++ b/lisp/org/ob-python.el
@@ -352,7 +352,7 @@ org-babel-python--send-string
 		   org-babel-python-eoe-indicator
 		   string-buffer))
 	(accept-process-output (get-buffer-process (current-buffer))))
-      (org-babel-chomp (substring string-buffer 0 (match-beginning 0))))))
+      (org-babel-chomp (substring string-buffer 1 (match-beginning 0))))))
 
 (defun org-babel-python-evaluate-session
     (session body &optional result-type result-params)