The design and implementation of org-blog

So, after some quantity of hacking, I have produced a first, basic, working version of org-blog (currently available on the dirty branch on github).

However, its git history reflects all the twists and turns and dead-ends and unfortunate omnibus-commits I did along the way. I really don’t want to have that be the basis for future development, etc., so I’m going to start filtering things into the master branch on github in logical, digestible, clean chunks.

Having made that choice, I figured, “What the hell?”, I might as well get some blog content out of it as well.

So, for the next however long it takes, I’ll be refactoring the code as it stands into logical sets of changes, and posting articles discussing them, as well all the other issues surrounding the implementation.

My ambition, of course, is to get a post written each day, but don’t hold me to that.

So, to start us out, here’s the beginning of our mode:

(provide 'org-blog)

(define-minor-mode org-blog-mode
  "Toggle org-blog mode.

With no argument, the mode is toggled on/off.
Non-nil argument turns mode on.
Nil argument turns mode off.


  :init-value nil
  :lighter " org-blog")

This is about as minimalist a minor mode as you can get—it does nothing at all, and even uses the define-minor-mode macro to avoid doing most of the work itself. But it’s a start.

One other thing I really believe in, though, is testing. So we’re going to try and keep everything reasonably tested as we go along. So here’s the test to make sure that enabling org-blog-mode goes as expected:

(ert-deftest ob-test-enable-org-blog-mode ()
    "Test turning on the org-blog minor mode"
      (eq org-blog-mode 1)))

That’s it until next time.