emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] org-add-planning-info: respect caller's given time [9.3.7 (r


From: Jack Kamm
Subject: Re: [PATCH] org-add-planning-info: respect caller's given time [9.3.7 (release_9.3.7-716-g3d4876 @ /home/n/.emacs.d/straight/build/org/)]
Date: Tue, 08 Sep 2020 07:23:24 -0700

Kyle Meyer <kyle@kyleam.com> writes:

> That's on a Debian system with the python executable pointing to Python
> 2.7.16.  If I set org-babel-python-command to python3 (3.7.3) at the top
> of test-ob-python.el, I see the same thing.  I haven't dug any farther
> yet.  Jack, presumably you don't see the stall on your end?

No, the tests don't stall on my end (Archlinux with manually compiled
emacs 28). I also tested on a debian10vm and the tests passed there too.

But since we know it's related to 4df12ea39 that gives some
clues...could you try the attached patch to see if it fixes things?

Also, could you try executing some simple ob-python session blocks and
see if they hang? e.g.,

#+begin_src python :session :results output
  print(1+1)
#+end_src

#+begin_src python :session :results value
  1+1
#+end_src

diff --git a/lisp/ob-python.el b/lisp/ob-python.el
index 1cded4515..a5af55892 100644
--- a/lisp/ob-python.el
+++ b/lisp/ob-python.el
@@ -223,6 +223,9 @@ (defun org-babel-python-initiate-session (&optional session 
_params)
     (org-babel-python-session-buffer
      (org-babel-python-initiate-session-by-key session))))
 
+(defvar org-babel-python-eoe-indicator "org_babel_python_eoe"
+  "A string to indicate that evaluation has completed.")
+
 (defconst org-babel-python-wrapper-method
   "
 def main():
@@ -324,7 +327,9 @@ (defun org-babel-python--send-string (session body)
           (comint-output-filter-functions
            (cons (lambda (text) (setq string-buffer
                                       (concat string-buffer text)))
-                 comint-output-filter-functions)))
+                 comint-output-filter-functions))
+          (body (format "%s\nprint('%s')"
+                        body org-babel-python-eoe-indicator)))
       (if (not (eq 'python-mode org-babel-python-mode))
          (let ((python-shell-buffer-name
                 (org-babel-python-without-earmuffs session)))
@@ -333,13 +338,10 @@ (defun org-babel-python--send-string (session body)
        (py-shell-send-string body (get-buffer-process session)))
       ;; same as `python-shell-comint-end-of-output-p' in emacs-25.1+
       (while (not (string-match
-                  (concat "\r?\n?"
-                          (replace-regexp-in-string
-                           (rx string-start ?^) "" comint-prompt-regexp)
-                          (rx eos))
+                  org-babel-python-eoe-indicator
                   string-buffer))
        (accept-process-output (get-buffer-process (current-buffer))))
-      (substring string-buffer 0 (match-beginning 0)))))
+      (org-babel-chomp (substring string-buffer 0 (match-beginning 0))))))
 
 (defun org-babel-python-evaluate-session
     (session body &optional result-type result-params)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]