Over at Arcadian Visions there’s a nice post on using literate programming techniques for making programming notes. The specific problem the post addresses is how to effectively take notes on some piece of programming arcana that you will want to remember later or perhaps share with a colleague. Part of the requirements is to have working code embedded with the note.
An excellent first order solution to this is, of course, Org mode and Babel and I’ve written several posts about that. This poster, though, is seeking a more “reproducible research-like” solution. He wants to be able to reproduce the original solution exactly as he performed it the first time: same code, same libraries, same everything. To restore the original environment he leverages direnv and nix. There is even an Emacs interface to direnv to make things easier.
Even if you don’t need or want to restore your original environment, the post is still worth reading for the Babel examples. Usually such examples are pretty simple but here the examples are more real world and use C++ and Haskell as the target languages. It even demonstrates how to teach Org to run a “new” language.
Anyone who uses or want to use Org Babel should read this post. It’s especially useful for anyone who wants to use Emacs and Org for reproducible research.