Creating a Daily Printed List from Agenda View

Purpose

Often I print my org-mode agenda view to make a daily action plan. I use this page for crossing off completed items with a highlighter pen, and for scribbling notes. The page is truly portable for use throughout the day, and my master org-mode file can be updated at the end of the day.

The agenda display format did not suit my needs, so I wrote a Python script to reformat the agenda display. All the information I needed was in the agenda view, but what was required was reformatting the details into a compact format.

Overal Steps

These are the steps:

Agenda file original format

My agenda has the following sort sequence:

 '(org-agenda-sorting-strategy 
    (quote ((agenda time-up priority-down tag-up))))

Time specific events are displayed first, then the items are sorted by tag (my GTD contexts).

 Day-agenda (W06):
 Saturday    7 February 2009
                8:00...... ----------------
               10:00...... ----------------
   Calendar:   10:30-11:30 Scheduled:  Softball at School
               12:00...... ----------------
               14:00...... ----------------
               16:00...... ----------------
               18:00...... ----------------
               20:00...... ----------------
   Tasks:      Scheduled:  TODO Scan Toastmasters magazines            :COMPUTER:
   Tasks:      Scheduled:  TODO Set up Budget worksheet for  2009      :COMPUTER:
   Tasks:      Scheduled:  TODO Write article on org-mode vocabulary   :COMPUTER:
   Tasks:      Scheduled:  TODO Update CER web site - photos           :COMPUTER:
   Tasks:      Scheduled:  TODO Update my GTD ordmode article (More)   :COMPUTER:
   Tasks:      Scheduled:  TODO Make notes on MADE TO STICK            :COMPUTER:
   Financial:  Scheduled:  TODO Reconcile Portfolio Loan               :COMPUTER:
   Tasks:      Scheduled:  TODO Sort out PROJECT Folder                    :HOME:
   Tasks:      Scheduled:  TODO Start sanding the trellis                  :HOME:
   Projects:   Scheduled:  TODO Study Japanese 15 minutes a day            :HOME:
   Tasks:      Scheduled:  TODO Read AMP Policy book from Penny         :READING:
   Borrowed:   Scheduled:  TODO Browse Everyday Law - on wills          :READING:
   Borrowed:   Scheduled:  TODO Read Away with Words (Wajnryb)          :READING:
 

Running the following command creates the file a.txt:

 python agenda_print.py > a.txt

The contents of the a.txt file are:

 -------------------------------------------------
 Day-agenda (W06):
 
 -------------------------------------------------
 Saturday    7 February 2009
 
 [ ] 10:30-11:30 Scheduled:  Softball at School
 
 COMPUTER
 [ ]  Scan Toastmasters magazines
 [ ]  Set up Budget worksheet for  2009
 [ ]  Write article on org-mode vocabulary
 [ ]  Update CER web site - photos
 [ ]  Update my GTD ordmode article (More)
 [ ]  Make notes on MADE TO STICK
 [ ]  Reconcile Portfolio Loan
 
 HOME
 [ ]  Sort out PROJECT Folder
 [ ]  Start sanding the trellis
 [ ]  Study Japanese 15 minutes a day
 
 
 READING
 [ ]  Read AMP Policy book from Penny
 [ ]  Browse Everyday Law - on wills
 [ ]  Read Away with Words (Wajnryb)
 

Now I open this file with Microsoft Word then print the document.

Paper in Action

Here is a scan of a typical page showing completed items crossed out with highlighter, and new items written by hand.

planner_page.jpg

Future Plans

The next step is to create LaTeX code instead of plain text, then automatically generate a PDF file in the Python script using MikTex.

The Script

You can download the file here.

Here is the contents of the agenda_print.py script.

import re

f = open("agen.txt", "r")
prevtag = "XYXYX"

for line in f:
    line = line[:-1]        # truncate the new line
    if line[:4] == "Week":
        print line
        prevtag = "XYXYX"
        continue
    if line[:1] != " ":
        print "\n\n\n-------------------------------------------------"
        print line
        continue
    if line[14:16] == "In":
        continue
    item = line[26:]
    timelabel = line[14:25]
    if timelabel == "Scheduled: ":
        timelabel = ""
    if timelabel == "Deadline:  ":
        continue

    todo = re.search('^TODO (.*?)$', item)
    if todo:
        item = todo.group(1)

    thistag = ""
    tagged = re.search('^(.*?)\s*:(.*?):', item)
    if tagged:
        item = tagged.group(1)
        thistag = tagged.group(2)

    if thistag != prevtag:
        print "\n\n", thistag
        prevtag = thistag
    print "[ ] %s %s"  %  (timelabel, item)

Feedback

I would be interested to hear your feedback on this article, as well as suggestions or comments on how you create printed agendas.

More information on custom agenda commands can be found on the orgmode worg site.


Author: Charles Cave <charlesweb@optusnet.com.au>

Date: 7th Feb 2009 Fri

HTML generated by org-mode 6.17c in emacs 22