posts tagged "literate programming"

New config project

28 June 2012 9:28 PM (org-mode | literate programming | config | project)

After reading that it was very easy to use Literate Programming for one's emacs init file and discovering that it's also a lot of fun to do, I was thinking that I could easily use this for all my configuration files.

Of course, not all programs have org-babel, so they can't all have something like this in their init file:

(require 'org)
(require 'ob-tangle)

(org-babel-load-file "~/.emacs.d/rinit.org")

Which, for emacs, tangles (extracts the code) and then loads the generated file. So something else has to be done.

On the other side of things, I, fairly recently, had a run-in with some Makefiles, which got me thinking that make is a very interesting tool and that it could be used to help with a lot of other tasks as well, much like I perceive Rake does. I just wasn't able to find where exactly it would fit (other than, of course, as compilation instructions for my projects).

Now, yesterday I got the idea of using org-mode to literate-program all my configuration files and then use make to tangle and install them. This would mean that I could easily keep documentation about decisions in configuration files and such in an easy to read format, easily export these files to somewhere on the web and practice my make skills to make everything easy.

Here is the result. I'm still working on it, as you can see my emacs init file still has a long way to go, my focus is on getting it in org-mode first and actually get it well-documented later. I've published it here, what I have at least, in case you would like to read about my mostly uninteresting configuration files.

Literate Emacs init

9 June 2012 1:19 AM (emacs | literate programming | org-mode)

A little while back I saw Sacha Chua mention using org-mode for literate programming. I'd heard of literate programming, but its use escaped me. Still, reading that and looking at what noweb is I started thinking that it would indeed be a great way of documenting code, especially something like my emacs init file, since that is not a serious software project and some weird stuff goes on in there.

I still didn't really get the hang of it. It seemed like a lot of work to get into it and how exactly it fit together with using org-mode didn't really hit me so I pushed it aside for the moment.

Today I see her presenting her new literately programmed init file with some links to other resources and I just had to try it too.

I haven't gotten very far yet, but what I have so far I have put here. It's just the generated HTML file, no org source, and I'm still messing around with the colors and stuff, but it's fun to see the result already.

I don't know if I'm actually going to use it, since my init file's sloc count is 1038 and its total line count is 1280 lines I fear that adding even more documentation (= lines) would make my init file very bulky. It is still fun to see and experiment with, though.