Org-mode basics VII: A TODO list with schedules and deadlines

In this post we’ll build on the simple todo list that we put together previously and add schedules and deadlines to our tasks to build a powerful agenda.

When adding a task (with C-c c t) you can add a scheduled date to it with C-c C-s or a deadline date with C-c C-d, or both. These will pop up a calendar which you can navigate using shift and the arrow keys.

I prefer to schedule all new tasks to today’s date as a default, so I update the org-capture-templates variable to

(setq org-capture-templates
      '(("t" "todo" entry (file+headline "~/todo.org" "Tasks")
         "* TODO [#A] %?\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n")))

Now when you add a task, you will see a scheduled field like this

** TODO [#A]
SCHEDULED: <2015-12-08 Tue>

You can edit the date by putting the cursor in it and using shift + arrow keys.

Now instead of using C-c a t to view your list of tasks, we will use C-c a n to display a list of your scheduled tasks and then any unscheduled tasks below it.

I have several configuration options that I recommend. Add the following to your emacs config file if you like the look of them:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; org-mode agenda options                                                ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;open agenda in current window
(setq org-agenda-window-setup (quote current-window))
;;warn me of any deadlines in next 7 days
(setq org-deadline-warning-days 7)
;;show me tasks scheduled or due in next fortnight
(setq org-agenda-span (quote fortnight))
;;don't show tasks as scheduled if they are already shown as a deadline
(setq org-agenda-skip-scheduled-if-deadline-is-shown t)
;;don't give awarning colour to tasks with impending deadlines
;;if they are scheduled to be done
(setq org-agenda-skip-deadline-prewarning-if-scheduled (quote pre-scheduled))
;;don't show tasks that are scheduled or have deadlines in the
;;normal todo list
(setq org-agenda-todo-ignore-deadlines (quote all))
(setq org-agenda-todo-ignore-scheduled (quote all))
;;sort tasks in order of when they are due and then by priority
(setq org-agenda-sorting-strategy
  (quote
   ((agenda deadline-up priority-down)
    (todo priority-down category-keep)
    (tags priority-down category-keep)
    (search category-keep))))

With these options we get a really useful view of our tasks when using C-c a n. For example, here is a todo.org file with a mixture of tasks with and without schedules and deadlines

* Tasks
** TODO [#A] do this today
SCHEDULED: <2015-12-08 Tue>
** TODO [#A] do this tomorrow
SCHEDULED: <2015-12-09 Wed>
** TODO [#A] this task is not scheduled
** TODO [#B] scheduled for today, priority B
SCHEDULED: <2015-12-08 Tue>
** TODO [#A] scheduled today and deadline in 2 days
DEADLINE: <2015-12-10 Thu> SCHEDULED: <2015-12-08 Tue>
** TODO [#A] deadline in 2 days and not scheduled
DEADLINE: <2015-12-10 Thu>
** TODO [#A] scheduled for monday
SCHEDULED: <2015-12-14 Mon>
** TODO [#C] do this today if I get time
SCHEDULED: <2015-12-08 Tue>
** TODO [#B] neither is this one
** TODO [#C] or this one
** TODO [#A] deadline in 10 days and not scheduled
DEADLINE: <2015-12-18 Fri>

When I view the agenda associated with this file I see this

example-agenda.png

  • I have been following your `org-mode` series. One thing I am not sure, now that I know little bit about org-mode, is how to organize files especially for tasks, notes, and project management. Do you one large folder for all org-mode files? Do you have individual folders for each project including one for personal todo lists?

    • This is really a mtter of personal preference. I have a single file in which I keep my todo items across all projects, and then have a seperate org file per project in a folder for that project. I could keep the tasks associated with a particular project in the file belonging to that project, but I prefer keeping them in one central file. This means I can sync one file to other places to keep track of my tasks (for example using orgzly on android).

      Others will have good arguments for doing the opposite though!

  • Pingback: 2015-12-14 Emacs News - sacha chua :: living an awesome life()

  • Pingback: Org Schedules and Deadlines | Irreal()

  • Prakash Nayak

    I have 2 questions as a newbie. The C-c C-c on my windows emacs install is bound to add tags and does nothing useful to capture a TODO entry. After updating the .emacs file, C-c c t does not pop up a new window/buffer to allow a TODO entry. What must I be doing wrong? The .emacs is exactly as shown in your post with changes done for the todo.org path on my PC.

    Also how does one allow a TODO entry made in any .org file to be visible in the agenda file (with a link back to the parent file)?

    • Prakash Nayak

      It worked after I added
      (require ‘org-capture) to .emacs. I assumed capture would be non-nil by default. Thank you for an instructive blog.

  • Emmanuel Goldstein

    Mmm, I tried your configuration, but not my cup of tea. The “now—–” line shows after other scheduled tasks and looks confusing. For instance:

    tasks: 14:00 meeting :meeting
    9:00 now ————————–

    Instead of seeing the current “now” with the upcoming tasks below “now”.

    Personally I prefer to see tasks ordered by time and not priority, but that is, again, my personal taste! 🙂 The priority status stands out by faces that one can choose for the purpose.

    Thanks for the post.

    • I see your point. Personally I don’t schedule tasks for specific times, only dates so I’ve not seen this, but I can see why you don’t like it!

      • Emmanuel Goldstein

        Thanks. Another question that I have been trying to get at: is it possible to attach warnings to time stamps which are not SCHEDULE or DEADLINE? Let’s say I have a doctor appointment (so it’s not a deadline or a schedule task – because I don’t intend to work on that). Just a mere one time event. Is it possible that emacs notifies me in the agenda a number of days in advance? Thanks! This would really useful.