If you’re a Python user and like to put Python snippets in source blocks in an Org mode file, John Kitchin has some very nice enhancements for you. Kitchin, as Irreal readers surely know by now, is a Chemical Engineering researcher at Carnegie Mellon. He does a huge amount of his work with Org and frequently embeds Python code in Org buffers. Some of this Python is long-running and therefore freezes Emacs because Babel runs the code synchronously.
Part of Kitchin’s enhancement fixes that by arranging for the code to run asynchronously so that you can do other work while the code is running. That’s actually something he figured out a while ago. What’s new is better error handling and a way to look at the results produced so far. His students complained that it’s hard to find the offending line from a stack trace in case of an error. Kitchin’s latest fix solves this by arranging for temporary line numbers to be put in the source block and for the cursor to go to the line that raised the error when it occurs. He also provides a link that you can click on to kill the running code if you need to.
Finally, he wraps autopep8 and pylint is emacs functions so that you can easily reformat code and check for syntax violations before you run it.
All of this is part of his Scimax distribution but this new code has not yet been merged into the master branch because he doesn’t want to change things mid-semester. He plans on merging it in Decemeber but gives a link to the experimental branch if you want to try it out now.