Literate Programming with Org-mode

Niklas Carlsson has posted a rerecording of a talk he gave at work about the power of Org-mode for literate programming and exploratory programming in general. Although he is running Emacs with the Doom package, you should have no trouble following the talk regardless of how you like to run Emacs.

Carlsson began with a brief introduction to Emacs and Org-mode but quickly moved to introducing code blocks and showing how you can intersperse text and code and then execute the code having the results be automatically included in the Org file. One of the things I liked was that he showed several ways of including the results of one block in another using sessions or tangling.

Another nice feature he demonstrated was embedding Elisp on the #+BEGIN_SRC line to calculate some of the parameters. He made use of that facility when he discussed building and running an application in a Docker image.

Next, he talked about Org tables and using Emacs Calc functions with them. Again, he showed how to chain data from one table to another making it easy to build up more complex tables from intermediate versions or to include one set of results into a new table for further analysis.

He showed how to export the results to a PDF but did this by manually calling the export routines rather than using the Org export menu. This was the only weakness in his talk. He ended up writing an Elisp function that exported to PDF and opened the resulting PDF file. That’s unnecessary because Org will do that for you from the export menu.

Finally, he demonstrated how he can export part of an Org file to his blog.

This is a great video and worth watching. It’s and hour and 23 minutes so you’ll definitely need to schedule some time. Carlsson has put all the source material for the talk on GitHub so if you want to study his code more closely than is possible during the talk, you should go there.

NOTE: Karl Voit also has a nice post on the video.

This entry was posted in General and tagged , . Bookmark the permalink.