GTD with Org Mode, Part I

May 16, 2011 § Leave a Comment

Org Mode is, as it’s name suggests, a text-editing mode for emacs that helps you deal with organizational tasks for virtually anything. The main philosophy is to use plain-text to keep the data portable, this allows you to edit your org files anywhere.

Introduction And Overview

This post describes my personal org mode configuration and the reasoning behind each choice. I won’t be explaining any of the basic org-mode syntax, the org manual already has an excelent tutorial on that. If you aren’t familiar with the basic syntax of org-mode I suggest you at least read the “Document Structure” section of the org mode manual before proceeding.

How to read this article

Emacs configuration files are prone to be enormous, and subject to a lot of change over time, so I decided to keep this as a permanent page on the blog so anyone can check the current state of my entire configuration and I’ll post a new entry every time something changes. If you’re looking for a step-to-step guide of how everything evolved into this page, look at the posts under the orgmode tag of the blog, ordered chronologically.

Installing

Org Mode has a very active contributor community, so development happens very fast and new features are being added every day, so I keep a close eye on the repository and mailing list. Generally, I hold off on implementing fancy things on my own until I get feedback from the ML, because odds are someone somewhere is trying to do something similar. My install is based on the bleeding edge version from git, which is very easy to set up:

git clone git://orgmode.org/org-mode.git

Org Babel

Babel is a feature that has to be mentioned before we start the actual tour of org mode, because it’s the feature that actually bootstraps the setup. Through this feature, you can evaluate code from several languages by using the following syntax:

#+begin_src emacs-lisp :results output
(message "%s" "hello world")
#+end_src

: hello world

Results can be produced in several different ways, depending on what language you’re evaluating.

I use org babel to keep my emacs file organized in several code blocks with structured comments to go along with them. This makes it easier to keep track of the rationale. In fact, this post is actually just a formatted export of my emacs startup org file, created by org-mode itself. You can download the raw org-mode file that originated this post from https://github.com/edenc/dotemacs/blob/master/emacs.org.

To use an org file as your emacs startup file, you need the following elisp snippet in your ~/.emacs file, to bootstrap the load process:

(setq dotfiles-dir
      (file-name-directory
       (or (buffer-file-name) load-file-name)))

(let* ((org-dir (expand-file-name
                 "lisp" (expand-file-name
                         "org" (expand-file-name
                                "src" dotfiles-dir))))
       (org-contrib-dir (expand-file-name
                         "lisp" (expand-file-name
                                 "contrib" (expand-file-name
                                            ".." org-dir))))
       (load-path (append (list org-dir org-contrib-dir)
                          (or load-path nil))))
  (require 'org-install)
  (require 'ob-tangle))

(mapc #'org-babel-load-file
      (directory-files
       (expand-file-name "~/etc/emacs")
       t "\\.org$"))

The above snippet loads the babel source blocks of all the .org files in the ~/etc/emacs directory, you should edit that to your preference. After setting up the bootstrap code in .emacs, you can mimic my setup with:

git clone git@github.com:edenc/dotemacs.git ~/etc/emacs

Activating

Org mode’s architecture is modular, so you get to pick what features to use by loading the equivalent modules.

These are the modules I use:

(setq org-modules
      '(org-bbdb
        org-gnus
        org-info
        org-jsinfo
        org-irc
        org-w3m
        org-id
        org-habit))
(require 'org-install)

To enable org mode automatically for .org and .orgarchive files:

(add-to-list 'auto-mode-alist
             '("\\.\\(org\\|org_archive\\)$" . org-mode))
Share:
  • Print
  • Facebook
  • Twitter
  • email
  • Google Buzz
  • HackerNews
  • Identi.ca
  • LinkedIn
  • del.icio.us
  • Reddit
  • Slashdot
  • Technorati
  • Tumblr
  • Digg

Tagged: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

What’s this?

You are currently reading GTD with Org Mode, Part I at et cetera.

meta