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