Closed stsquad closed 6 years ago
OK, have re-based to avoid conflicts.
OK I see the tests explicitly test for the position after the test has run. Are these valid tests? Do you want to mandate we always return to the block after execution or provide another mechanism to go there?
@stsquad Yes, those tests are valid. The expected behavior is that the results block is updated without interfering with interactive typing, as you alluded to you in your commit message.
It seems to me that this has the opposite effect however, since it places the point back at the beginning of the src block.:
@astahlman ahh my tests were while editing in another buffer. We should be able to fix this by using a save-excursion as well. I have pushed an update.
@astahlman ping. Are you happy with the behaviour with save-excursion? It passes the tests now.
@stsquad Yep, looks good now. Thanks for this!
Currently when updating the results buffer the user might get surprised if they are in the middle of typing. This is because using switch-to-buffer will interfere with interactive typing, as the documentation notes:
WARNING: This is NOT the way to work on another buffer temporarily within a Lisp program!
Rather than using set-buffer though we can simply use the (with-current-buffer) wrapper. This also means we don't need the register hack to save our position. The user will still see the "Code block evaluation complete." message appear in the miibuffer but we could make a cleaner message. This is left as an exercise for a later patch.
Signed-off-by: Alex Bennée alex.bennee@linaro.org