1 #+OPTIONS: H:3 num:nil toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t TeX:t LaTeX:t skip:nil d:(HIDE) tags:not-in-toc
2 #+STARTUP: align fold nodlcheck hidestars oddeven lognotestate
3 #+SEQ_TODO: TODO(t) INPROGRESS(i) WAITING(w@) | DONE(d) CANCELED(c@)
4 #+TAGS: Write(w) Update(u) Fix(f) Check(c)
5 #+TITLE: Tracking Habits with Org-mode
7 #+EMAIL: mdl at imapmail dot org
12 [[file:index.org][{Back to Worg's index}]]
16 Task management systems such as GTD are good for keeping track of
17 projects and todos, as well as periodically recurring tasks. But what
18 is the best way for remembering the daily tasks that one wants to
19 develop as habits? Exercise, relaxation, household cleaning, diet,
20 kindness to others---such habitual obligations can often get lost in
21 the constant clamor of urgent todos. In the midst of everything else,
22 how can you learn to stop biting your nails?
24 Though the ultimate aim of developing good habits is to internalize
25 them so deeply that one needs no reminders (because they become
26 "second nature"), the most difficult stage is the month or so it takes
27 to learn a new habit. Success often depends both on a commitment to
28 develop a habit /and/ some external means of monitoring one's
31 This tutorial offers a couple of ideas of how to use org-mode to track
32 habits---with the ultimate aim, of course, of kicking bad habits and
33 learning good ones. A program as powerful as org-mode, of course, has
34 multiple routes to the same end, but these are a few of the techniques
35 that I have found helpful.
37 ** Note: New Module (org-habit)
39 John Wiegley has written a new module for org-mode that provides a
40 much more robust means of tracking habits than the rather ad-hoc
41 methods outlined below. Check back here soon for more details about
46 A habit is often something you'd like to do every day (or, in some
47 cases, every other day or every week). Org-mode makes scheduling such
48 repeating tasks very easy. To create a recurring task in org-mode,
49 simply schedule the task for the day you'd like to start and add a
50 "repeater" such as =+1d= for every day, =+2d= for every other day,
51 =+1w= for every week, and so on. Here's an example:
53 : ** TODO Lift weights
54 : SCHEDULED: <2009-01-18 Sun +2d>
56 Now the agenda will remind you to lift weights every other day. When
57 you mark the item DONE, it will be reactivated as a TODO and
58 pushed two days into the future (in this case to January 20).
60 (If you are procrastinating often, you can add a period in front of
61 the repeater, such as =.+2d= which will reschedule the completed item
62 two days /after it is completed/.)
66 Scheduling a habitual task is only a small step on the path to
67 internalizing it. You also need to provide yourself with some
68 incentive to learn the habit. Without such incentive, it is easy to
69 procrastinate, rescheduling the daily habits---the least urgent
70 todos---to tomorrow...and tomorrow...and tomorrow.
72 Some productivity guides suggest an simple method for learning a
73 habit. Let's say you want to exercise daily. Take a calendar and cross
74 out each day you exercise. Your goal is to keep the chain of X's
77 Org-mode can provide similar tracking for recurring tasks via the
78 variable =org-log-repeat=. If this variable is set to "time", then a
79 timestamp will be recorded each time the item is marked done. For the
80 example above, the results would look like this:
82 : ** TODO Lift weights
83 : SCHEDULED: <2009-01-22 Thu +2d>
84 : - State "DONE" [2009-01-16 Fri 23:14]
85 : - State "DONE" [2009-01-14 Wed 17:25]
87 You can see whether you've "broken the chain" by reviewing the log of
88 when you completed the item. If you want even more detailed tracking
89 (or want to leave yourself encouraging notes), you can set
90 =org-log-repeat= to "note". Then, each time you complete a recurring
91 task, you will be prompted to enter a note.
93 If you want to enable such logging only for particular tasks, then you
94 can do so via properties:
96 : ** TODO Lift weights
97 : SCHEDULED: <2009-01-20 Tue +2d>
98 : - State "DONE" [2009-01-18 Sun 23:22] \\
101 : :LOGGING: lognoterepeat
104 * Monitoring Progress
106 It's nice to have a record of how well you're learning your new habit.
107 But it's especially nice to get a visual representation that gives you
108 a quick overview of how often you've "broken the chain"---i.e., let
111 One easy way to get a visual representation of a habit is to keep a
112 quick chart in a table. If you want to make sure you exercise every
113 day, you could type the following:
115 : | Week Starting | Mon | Tues | Wed | Thurs | Fri | Sat | Sun
117 And then press tab to create a nice table that you can fill in:
119 : | Week Starting | Mon | Tues | Wed | Thurs | Fri | Sat | Sun |
120 : |---------------+-----+------+-----+-------+-----+-----+-----|
121 : | Jan 12 | x | x | x | x | | x | x |
122 : | Jan 20 | x | x | x | | x | x | x |
124 Ooops. I forgot to exercise a couple of times.
126 For a more robust habit tracking, I use the following technique:
128 For each daily habit I want to develop, I create a recurring task. I
129 also add a special tag "DAILY". Then I make sure to check the task as
130 DONE each day I complete it:
133 : ** TODO Do dishes :DAILY:
134 : SCHEDULED: <2009-01-22 Thu +1d>
135 : - State "DONE" [2009-01-20 Tue 12:59]
136 : - State "DONE" [2009-01-21 Wed 20:10]
137 : ** TODO Exercise :DAILY:
138 : SCHEDULED: <2009-01-22 Thu +1d>
139 : - State "DONE" [2009-01-19 Mon 19:59]
140 : - State "DONE" [2009-01-21 Wed 07:58]
141 : ** TODO Floss :DAILY:
142 : SCHEDULED: <2009-01-22 Thu +1d>
143 : - State "DONE" [2009-01-19 Mon 17:15]
144 : - State "DONE" [2009-01-20 Tue 11:05]
146 In my agenda view I can quickly filter for daily habits using a
151 Or I can filter out DAILY tasks to unclutter the agenda view:
155 Finally, I can see how well I've kept up with my habits by using a
156 custom agenda command:
158 #+BEGIN_SRC emacs-lisp
159 (setq org-agenda-custom-commands
160 '(("h" "Daily habits"
162 ((org-agenda-show-log t)
164 (org-agenda-log-mode-items '(state))
165 (org-agenda-skip-function '(org-agenda-skip-entry-if 'notregexp ":DAILY:"))))
166 ;; other commands here
170 This command gives me a weekly view of whether and when I accomplished my
174 : Monday 19 January 2009 W04
175 : habits: 17:15...... State: (DONE) TODO Floss :DAILY:
176 : habits: 19:59...... State: (DONE) TODO Exercise :DAILY:
177 : Tuesday 20 January 2009
178 : habits: 11:05...... State: (DONE) TODO Floss :DAILY:
179 : habits: 12:59...... State: (DONE) TODO Do dishes :DAILY:
180 : Wednesday 21 January 2009
181 : habits: 7:58...... State: (DONE) TODO Exercise :DAILY:
182 : habits: 20:10...... State: (DONE) TODO Do dishes :DAILY:
183 : Thursday 22 January 2009
184 : habits: Scheduled: TODO Do dishes :DAILY:
185 : habits: Scheduled: TODO Exercise :DAILY:
186 : habits: Scheduled: TODO Floss :DAILY:
187 : Friday 23 January 2009
188 : Saturday 24 January 2009
189 : Sunday 25 January 2009
191 Again, these are just a couple of ways that I use org-mode to keep
192 track of regular habits. I hope this brief tutorial gives a few more
193 ideas about how to use this wonderful time management program.