From 11b293438db89eed8ba69a05da17977a799454f7 Mon Sep 17 00:00:00 2001 From: Nathaniel Nicandro Date: Thu, 25 Jul 2019 03:33:58 -0500 Subject: [PATCH] jupyter-generate-request (jupyter-org-client): Consider `babel-call` org elements Fixes #154. --- jupyter-org-client.el | 3 ++- test/jupyter-test.el | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/jupyter-org-client.el b/jupyter-org-client.el index a1440d4..e3ada19 100644 --- a/jupyter-org-client.el +++ b/jupyter-org-client.el @@ -124,7 +124,8 @@ See also the docstring of `org-image-actual-width' for more details." (save-excursion (goto-char org-babel-current-src-block-location) (let* ((context (org-element-context)) - (block-params (nth 2 (org-babel-get-src-block-info nil context))) + (block-params (nth 2 (or (org-babel-get-src-block-info nil context) + (org-babel-lob-get-info context)))) (result-params (alist-get :result-params block-params))) (jupyter-org-request :marker (copy-marker org-babel-current-src-block-location) diff --git a/test/jupyter-test.el b/test/jupyter-test.el index 62c3af8..5563bf6 100644 --- a/test/jupyter-test.el +++ b/test/jupyter-test.el @@ -2759,6 +2759,25 @@ publish_display_data({'text/plain': \"foo\", 'text/latex': \"$\\alpha$\"});" ": foo\n" :display "plain")) +(ert-deftest org-babel-jupyter-babel-call () + :tags '(org babel) + (jupyter-org-test + (insert (format "\ +#+NAME: foo +#+begin_src jupyter-python :async yes :session %s +1 + 1 +#+end_src + +" jupyter-org-test-session)) + (insert " +#+CALL: foo()") + (org-ctrl-c-ctrl-c) + (beginning-of-line) + (jupyter-wait-until-idle (jupyter-org-request-at-point)) + (goto-char (org-babel-where-is-src-block-result)) + (forward-line) + (should (looking-at-p ": 2\n")))) + ;; Local Variables: ;; byte-compile-warnings: (unresolved obsolete lexical) ;; eval: (and (functionp 'aggressive-indent-mode) (aggressive-indent-mode -1))