Change a heading in the FAQ
[Worg/babel-doc.git] / org-tutorials / tracking-habits.org
blob87cbb4c3cf9b5debd6450f7b225efd2a5344116f
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
6 #+AUTHOR:     Matt Lundin
7 #+EMAIL:      mdl at imapmail dot org
8 #+LANGUAGE:   en
9 #+PRIORITIES: A C B
10 #+CATEGORY:   worg
12 [[file:index.org][{Back to Worg's index}]]
14 * Introduction
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
29 progress.
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 * Repeating Tasks
39 A habit is often something you'd like to do every day (or, in some
40 cases, every other day or every week). Org-mode makes scheduling such
41 repeating tasks very easy. To create a recurring task in org-mode,
42 simply schedule the task for the day you'd like to start and add a
43 "repeater" such as =+1d= for every day, =+2d= for every other day,
44 =+1w= for every week, and so on. Here's an example:
46 : ** TODO Lift weights
47 :    SCHEDULED: <2009-01-18 Sun +2d>
49 Now the agenda will remind you to lift weights every other day. When
50 you mark the item DONE, it will be reactivated as a TODO and
51 pushed two days into the future (in this case to January 20).
53 (If you are procrastinating often, you can add a period in front of
54 the repeater, such as =.+2d= which will reschedule the completed item
55 two days /after it is completed/.)
57 * Tracking Completion
59 Scheduling a habitual task is only a small step on the path to
60 internalizing it. You also need to provide yourself with some
61 incentive to learn the habit. Without such incentive, it is easy to
62 procrastinate, rescheduling the daily habits---the least urgent
63 todos---to tomorrow...and tomorrow...and tomorrow.
65 Some productivity guides suggest an simple method for learning a
66 habit. Let's say you want to exercise daily. Take a calendar and cross
67 out each day you exercise. Your goal is to keep the chain of X's
68 going.
70 Org-mode can provide similar tracking for recurring tasks via the
71 variable =org-log-repeat=. If this variable is set to "time", then a
72 timestamp will be recorded each time the item is marked done. For the
73 example above, the results would look like this:
75 : ** TODO Lift weights
76 :    SCHEDULED: <2009-01-22 Thu +2d> 
77 :    - State "DONE"       [2009-01-16 Fri 23:14]
78 :    - State "DONE"       [2009-01-14 Wed 17:25]
80 You can see whether you've "broken the chain" by reviewing the log of
81 when you completed the item. If you want even more detailed tracking
82 (or want to leave yourself encouraging notes), you can set
83 =org-log-repeat= to "note". Then, each time you complete a recurring
84 task, you will be prompted to enter a note.
86 If you want to enable such logging only for particular tasks, then you
87 can do so via properties:
89 : ** TODO Lift weights
90 :    SCHEDULED: <2009-01-20 Tue +2d>
91 :    - State "DONE"       [2009-01-18 Sun 23:22] \\
92 :      Way to go!
93 :   :PROPERTIES:
94 :   :LOGGING:  lognoterepeat
95 :   :END:
97 * Monitoring Progress
99 It's nice to have a record of how well you're learning your new habit.
100 But it's especially nice to get a visual representation that gives you
101 a quick overview of how often you've "broken the chain"---i.e., let
102 the new habit slip.
104 One easy way to get a visual representation of a habit is to keep a
105 quick chart in a table. If you want to make sure you exercise every
106 day, you could type the following:
108 : | Week Starting | Mon | Tues | Wed | Thurs | Fri | Sat | Sun 
110 And then press tab to create a nice table that you can fill in:
112 : | Week Starting | Mon | Tues | Wed | Thurs | Fri | Sat | Sun |
113 : |---------------+-----+------+-----+-------+-----+-----+-----|
114 : | Jan 12        | x   | x    | x   | x     |     | x   | x   |
115 : | Jan 20        | x   | x    | x   |       | x   | x   | x   |
117 Ooops. I forgot to exercise a couple of times.
119 For a more robust habit tracking, I use the following technique:
121 For each daily habit I want to develop, I create a recurring task. I
122 also add a special tag "DAILY". Then I make sure to check the task as
123 DONE each day I complete it:
125 : * Habits
126 : ** TODO Do dishes                                                      :DAILY:
127 :    SCHEDULED: <2009-01-22 Thu +1d> 
128 :    - State "DONE"       [2009-01-20 Tue 12:59]
129 :    - State "DONE"       [2009-01-21 Wed 20:10]
130 : ** TODO Exercise                                                       :DAILY:
131 :    SCHEDULED: <2009-01-22 Thu +1d> 
132 :    - State "DONE"       [2009-01-19 Mon 19:59]
133 :    - State "DONE"       [2009-01-21 Wed 07:58]
134 : ** TODO Floss                                                          :DAILY:
135 :   SCHEDULED: <2009-01-22 Thu +1d> 
136 :   - State "DONE"       [2009-01-19 Mon 17:15]
137 :   - State "DONE"       [2009-01-20 Tue 11:05]
139 In my agenda view I can quickly filter for daily habits using a
140 secondary query:
142 : C-c a / DAILY
144 Or I can filter out DAILY tasks to unclutter the agenda view:
146 : C-c a / - DAILY
148 Finally, I can see how well I've kept up with my habits by using a
149 custom agenda command:
151 #+BEGIN_SRC emacs-lisp
152 (setq org-agenda-custom-commands
153       '(("h" "Daily habits" 
154          ((agenda ""))
155          ((org-agenda-show-log t)
156           (org-agenda-ndays 7)
157           (org-agenda-log-mode-items '(state))
158           (org-agenda-skip-function '(org-agenda-skip-entry-if 'notregexp ":DAILY:"))))
159         ;; other commands here
160         ))
161 #+END_SRC
163 This command gives me a weekly view of whether and when I accomplished my
164 daily goals:
166 : Week-agenda (W04):
167 : Monday     19 January 2009 W04
168 :   habits:     17:15...... State:     (DONE) TODO Floss                   :DAILY:
169 :   habits:     19:59...... State:     (DONE) TODO Exercise                :DAILY:
170 : Tuesday    20 January 2009
171 :   habits:     11:05...... State:     (DONE) TODO Floss                   :DAILY:
172 :   habits:     12:59...... State:     (DONE) TODO Do dishes               :DAILY:
173 : Wednesday  21 January 2009
174 :   habits:      7:58...... State:     (DONE) TODO Exercise                :DAILY:
175 :   habits:     20:10...... State:     (DONE) TODO Do dishes               :DAILY:
176 : Thursday   22 January 2009
177 :   habits:     Scheduled:  TODO Do dishes                                 :DAILY:
178 :   habits:     Scheduled:  TODO Exercise                                  :DAILY:
179 :   habits:     Scheduled:  TODO Floss                                     :DAILY:
180 : Friday     23 January 2009
181 : Saturday   24 January 2009
182 : Sunday     25 January 2009
184 Again, these are just a couple of ways that I use org-mode to keep
185 track of regular habits. I hope this brief tutorial gives a few more
186 ideas about how to use this wonderful time management program.