Closed stnutt closed 7 years ago
This is great - love the tests!
Regarding finding the #+CALL
or src block: I can't think of any good reason why we would need to handle a case where there's something in between the #+RESULTS
block and the block that generated it. Given that the tests are green, I'm happy to keep the implementation simple. If it causes problems later we can always revisit.
I'm merging this and closing the related issues. Thanks for the pull request!
This fixes #10 and #11. It's essentially what I discuss in #10.
org-babel-execute-src-block
is advised with the ob-async function when the ob-async package is loaded. If the block being executed does not have an:async
parameter, then the unadvisedorg-babel-execute-src-block
is called. To preserve backwards compatibility with theorg-ctrl-c-ctrl-c-hook
, if the ob-async function is invoked not as advice, then it gives a warning and does nothing, which allowsorg-babel-execute-src-block
to get executed instead during ctrl-c-ctrl-c, rerunning the async function as advice, and allowing asynchronous execution to take place.There's a new test case for the
#+NAME
use case, one for the#+CALL
use case, and one withorg-ctrl-c-ctrl-c-hook
set as well.One caveat worth discussing, is that I had to change how the code gets from the results block back to the source block. As
org-babel-previous-src-block
does not go back to a#+CALL
. Instead, I'm callingorg-backward-element
twice: first to get to the beginning of the results block, and again to go to the previous element, which should be either the#+CALL
or the source block. However, if there is some other element in between, then this will fail. I couldn't think of a better way that's also simple. Maybe you can think of one, or are fine with that method?