Frédérick Giasson, whom I’ve mentioned before, has a nice post on setting up Org mode for literate programming. Giasson’s post is mostly concerned with using literate programming to write Clojure but almost all of his setup is usable for other languages.
It’s a testament to the power of Org mode that very little has to be changed from the default settings to have a first class environment. Most of the significant changes that Giasson made involved setting up the environment for Clojure.
One non-trivial change he made for Org was to tangle the code automatically when the file is saved. That keeps the code file up-to-date with the Org source file. To make sure his buffers stay up to date, he calls global-auto-revert-mode
so that when the code file is updated, any open buffers for the file are reloaded.
If you’re interested in trying out literate programming in an easy way, give Giasson’s post a read to see how little effort is required.