Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ob-async.el
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ block."
((not orig-fun)
(warn "ob-async-org-babel-execute-src-block is no longer needed in org-ctrl-c-ctrl-c-hook")
nil)
;; If there is no :async parameter, call the original function
((not (assoc :async (nth 2 (or info (org-babel-get-src-block-info)))))
;; If there is no `:async' parameter or we have `:async no', call the original function
((let ((async-maybe (assoc :async (nth 2 (or info (org-babel-get-src-block-info))))))
(or (not async-maybe) (string-equal (cdr async-maybe) "no")))
(funcall orig-fun arg info params))
;; If the src block language is in the list of languages async is not to be
;; used for, call the original function
Expand Down
12 changes: 12 additions & 0 deletions test/ob-async-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,18 @@ POST-FORM is executed after the src-block finishes execution"
(org-ctrl-c-ctrl-c)
(should (string= "Sorry for the wait." (results-block-contents))))))

(ert-deftest test-async-no ()
"Testing ignoring async when `:async no' is set."
(let ((buffer-contents "Here's a shell source block:

#+BEGIN_SRC sh :async no
sleep 1s && echo 'Sorry for the wait.'
#+END_SRC"))
(with-buffer-contents buffer-contents
(org-babel-next-src-block)
(org-ctrl-c-ctrl-c)
(should (string= "Sorry for the wait." (results-block-contents))))))

(ert-deftest test-async-execute-existing-sh-block ()
"Test that we can insert results for a sh block that has already been executed"
(let ((buffer-contents "Here's a shell source block:
Expand Down