Use marker to keep track of src_block #48
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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] #46