astahlman / ob-async

Asynchronous src_block execution for org-babel
343 stars 32 forks source link

Use marker to keep track of src_block #48

Closed astahlman closed 5 years ago

astahlman commented 5 years ago

The function org-babel-insert-result assumes that point is on the SRC_BLOCK that we are executing. This wasn't true, in our case - we were inserting/overwriting the RESULTS block with a placeholder GUID, then searching for the GUID in our results callback and putting point on the RESULTS block. This causes problems in some corner-cases, e.g., named SRC_BLOCKS with spaces in the names (see [1]).

Instead of marking our place in the buffer with a GUID, we can simplify thing by leaving ourselves a marker. We already know the location of the current SRC_BLOCK when we start execution - we just need to keep a reference to it in our callback function.

The GUID that we insert into the results block is serving no purpose now, so we could remove it or replace it with a more informative message. I'll leave it as-is for now and revisit later.

[1] https://github.com/astahlman/ob-async/issues/46