jupyter-org-insert-async-id -> jupyter-org-pending-async-results

This commit is contained in:
Nathaniel Nicandro 2019-03-17 02:06:00 -05:00
parent cdc826259e
commit 3b6b60d803
2 changed files with 16 additions and 10 deletions

View file

@ -1268,9 +1268,15 @@ buffer."
;;; org-babel functions
;; These are meant to be called by `org-babel-execute:jupyter'
(defun jupyter-org-insert-async-id (req)
"Insert the ID of REQ.
Meant to be used as the return value of
(defun jupyter-org-pending-async-results (req)
"Finish up bookkeeping for an asynchronous source block REQ.
Setup `org-babel-after-execute-hook' to insert the ID of REQ as
the result of the associated source block, to signify that the
results of REQ are pending, and run any other hook functions that
were present before this function was called.
This function always returns nil and is intended to be used as
the return value for asynchronous Jupyter source blocks in
`org-babel-execute:jupyter'."
(prog1 nil
(let ((log-max message-log-max)
@ -1278,12 +1284,12 @@ Meant to be used as the return value of
(id (jupyter-org-scalar (jupyter-org-request-id req))))
(setq message-log-max nil)
(setq org-babel-after-execute-hook
(lambda ()
(setq message-log-max log-max)
(unwind-protect
(jupyter-org--add-result req id)
(setq org-babel-after-execute-hook hook)
(run-hooks 'org-babel-after-execute-hook)))))))
(list (lambda ()
(setq message-log-max log-max)
(unwind-protect
(jupyter-org--add-result req id)
(setq org-babel-after-execute-hook hook)
(run-hooks 'org-babel-after-execute-hook))))))))
(defun jupyter-org--coalesce-stream-results (results)
"Return RESULTS with all contiguous stream results concatenated.

View file

@ -304,7 +304,7 @@ the PARAMS alist."
(when (bound-and-true-p org-export-current-backend)
(add-hook 'org-babel-after-execute-hook #'sync-on-export t t))
(if (jupyter-org-request-inline-block-p req) ""
(jupyter-org-insert-async-id req))))
(jupyter-org-pending-async-results req))))
(t
(let ((result-params (assq :result-params params)))
(when (and (member "file" result-params)