Org-mode and habits

Org Mode is a personal information manager for the Emacs text editor. People have contributed a ton of useful features to it over the years, and the development shows no sign of slowing down. One of the features I’ve been playing around with is the ability to track habits.

Org habits are recurring tasks. For example, everyday, I want to:

  • take my vitamins
  • capture a quick note about the day, and
  • plan the next day

Every week, I want to:

  • talk to my mom
  • check the org-mode mailing list
  • write a weekly review and plan the next week
  • clear and reorganize my belt bag
  • clear my inbox
  • write a bunch of blog posts
  • back up my computer

Once a month, I want to:

  • update the topical index for my blog
  • review and uninstall programs
  • balance my books and update my budget
  • review the past month and plan the next
  • check the library for new books

Org habits let me manage my task list without cluttering future days with tasks. The Org agenda view displays habits that are due today, indicating consistency with colour. In particular, it shows overdue days in red, so you can get the Seinfeld-esque pleasure/commitment-device of not breaking the chain.

Here’s a view from Sunday:

2 days-agenda (W19-W20):
Sunday     13 May 2012
               8:00...... ----------------
              10:00...... ----------------
              12:00...... ----------------
              14:00...... ----------------
              15:57...... now - - - - - - - - - - - - - - - - - - - - - - - - -
              16:00...... ----------------
              18:00...... ----------------
  organizer:  22:00...... TODO Capture a one-sentence note                                           !       
  organizer:  22:00...... TODO Plan the next day                                    ** ***** ** *****!       
  organizer:  Scheduled:  TODO Make a list of recipes I want to learn
  organizer:  Scheduled:  TODO Write a bunch of blog posts             :writing:
  organizer:  Scheduled:  TODO Set up WordPress as my backup system
Monday     14 May 2012 W20
  organizer:  Scheduled:  TODO Build Emacs interface so that I can have Org automatically switch my tasks

To use Org habits, customize org-modules and enable the habit module. To set something as a habit, use C-c C-x p (org-set-property) to set the STYLE property to habit. For more information, you should definitely check out the Org manual’s section on habits.

Yay Emacs and the people who contribute to it!

16 responses to “Org-mode and habits”

  1. Nuno says:

    I had no idea this functionality existed in org-mode. Will definitely have a look, it’s something that I’ve needed for a long time. Thanks for the tip!

  2. Greg says:

    This is really useful, but I can’t seem to figure out one part. According to the org manual, “What’s really useful about habits is that they are displayed along with a consistency graph, to show how consistent you’ve been at getting that task done in the past.”. How does one activate this graph? Where should I expect to see it? It doesn’t show up in my agenda view.

  3. Greg says:

    Oh, never mind, I had things misconfigured a bit

  4. Soha says:

    This sounds really good! But how can I get started? I downloaded it but have no idea what to do next!

  5. Sacha Chua says:

    Soha: Gosh, Emacs has a bit of a learning curve. This beginner’s guide might be useful, and you might also try looking for beginner’s guides to Emacs. Someday I may write a from-scratch tutorial. Are you on Microsoft Windows, Mac OS X, or some kind of Linux?

  6. This seems very useful. However I have a question. I want to create a habit that repeats every weekday, i.e. I want to do it every Monday to Friday, but not necessarily on Saturday and Sunday. Can I do that in orgmode? If yes then how?

  7. Varun Vats says:

    Soha,

    The best way to learn Emacs, in my opinion, is:

    1. Take a week off from what you do.

    2. Open Emacs

    3. Press C-h t (i.e. Control+h followed by t).

    Trust me, you will thank yourself for taking that week off.

    — Varun Vats

  8. rjh says:

    Another area that emacs is taking some interesting steps in personal information managing is the “notmuch” system for email. It’s a tag & text indexer for email that has been integrated with emacs (and mutt if you prefer mutt).
    It’s got a viewer for mail indexes and threads, although if you want there is an integration with GNUS. I use the notmuch viewers. The thread view shows the email thread subjects that match a tag/text search. Message view mode shows the thread contents.
    Integration with email composing, delivery etc., is limited but works. It’s still a do-it-yourself operation for integration with procmail or other delivery systems. It uses on GNUS or Mutt for composing email and other mail operations.
    It’s now past the “too fragile for anyone but developers” stage. It’s into the “mostly working system ready for lots of improvements” stage. It’s growing rapidly as more people start filling the gaps. I can see some interesting potential for linkages with org-mode as it stabilizes.
    I’m forced to use Notes at work and the difference in capabilities and performance as a mail manager is huge. It makes the slow Notes performance painful.

  9. Nuno says:

    Sacha, the manual doesn’t actually explain how to customize the org-modules and enable habits… and you weren’t clear on how to do it.
    I added the following to my .emacs file:
    (add-to-list 'org-modules 'org-habit)
    (require 'org-habit)

  10. Sacha Chua says:

    Nuno: M-x customize-variable RET org-modules gets you lots of great options. =) There are so many – I should check them out!

    rjh: Envy. =) I should get mail working in my Microsoft Windows setup again.

    Truong Nghiem: Doesn’t look like there are weekday repeats for habits, but you can probably get away with making it a daily habit and then also marking it done during the weekends.

  11. Nuno says:

    Thanks, Sacha, I now feel like a kid in a candy store! :)

  12. Soha says:

    Thanks, Varun …and Sacha, I’m using Microsoft Windows. I’ll check out your beginners guide. I don’t know if I can take a whole week off but I’ll try to fit in somehow!

  13. Thanks! I was wondering how Org-mode does recurrence, and now I know!

  14. Daniel H says:

    Hi Sacha, How did you produce that agenda view?

  15. Om Prakash says:

    Hi Sacha, I Like reading your blogs, and got the inspiration to use emacs, though i am a no programmer, had an experience as a Unix SA, and have an inclination to learn programming and i like the way you treat the topic. As I was reading in this post of yours about org-habits, I couldn’t figure out how i may be able to use it. I use emacs 24 but i didn’t find org-modules in it. If you could let me know how its done. It would be helpful.

    1. sachac says:

      Sorry for the delay! You should be able to use M-x customize-variable RET org-modules RET to add or remove items from that list. In addition, check out the documentation in org-habits ( http://orgmode.org/manual/Tracking-your-habits.html) to see the property you need to add (:STYLE: habit) and how to specify the repetition frequency in the Scheduled line. Hope that helps!

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>