Converting my .emacs to org-babel

Recently a coworker pointed me to this blog post which shows how to use org-babel to organize your .emacs file into an org-mode document. I've made this change and I love it. I had for a long time been meaning to organize my huge, mostly monolithic emacs initialization file into more managable chunks. This let me keep my large monolithic config while still letting me organize it into better chunks.

Now my ~/.emacs/init.el consists of only these lines:

    (require 'package)
    (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
    (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
    (package-initialize)
    (require 'ob-tangle)
    (org-babel-load-file "~/.emacs.d/Stew.org")

and the rest of my configuration gets organized into the Stew.org file. That file can now be organized using org mode, and contain marked code sections which are exported by orb babel into a Stew.el file, which is then loaded as part of initialization. Here's an example section of my Stew.org:

    * widgets
    ** ace jump
    http://www.emacswiki.org/emacs/AceJump
    
    fast cursor movement. see the demo:
    http://dl.dropboxusercontent.com/u/3254819/AceJumpModeDemo/AceJumpDemo.htm
    
    #+begin_src emacs-lisp
    (autoload
       'ace-jump-mode
       "ace-jump-mode"
       "Emacs quick move minor mode"
       t)
    
    (autoload
      'ace-jump-mode-pop-mark
      "ace-jump-mode"
      t)
    (eval-after-load "ace-jump-mode"
      '(ace-jump-mode-enable-mark-sync))
    (define-key global-map (kbd "C-x SPC") 'ace-jump-mode-pop-mark)
    #+end_src

And now2 that my .emacs file is organized in org-mode, I can export it as a decent looking .html file or PDF. You can view an htmlized version of my .emacs file here..

There are clearly some improvements I should be making to this file. I could be adding more comments. I could be making better use of org-mode (always, everyone always could be). One particularly interesting thing I see in Sacha's .emacs file is that she is using the :drill tag which should let her use Org-Drill to treat these entries as flashcards. This to me seems great, there are neat little tricks I find, drop in my .emacs file and forget about them. This would be a way to go back and remind myself of some of the lesser known things in my .emacs files that I wish I was making more use of. (Like ace-jump mode above!).