Converting from TaskPaper to Emacs Org-Mode

Why TaskPaper and Org-Mode?

TaskPaper is a simple and elegant task management software for the OSX platform. It combines the simplicity of a text micro-format to mark the tasks, and the elegance of a Mac UI. It also provides a quick launch time and a nice system-wide quick entry window that is accessible with a single shortcut key.

tasks.png

taskpapercapturewindow.png

I have been a heavy user of Emacs’ Org-Mode for some years now, and love the power and flexibility it offers for tracking not just outlines and tasks, but any text based item, including notes and calendar entries. In fact Org-Mode has become one of the primary software that I use regularly, every day.

So where does the link between TaskPaper and Org-Mode come in? Both are text based, and have their own light-weight formats to define outlines and tasks. The underlying files are plain text with the meaning readable even when not viewed by the appropriate software. Org-Mode is obviously much more feature rich than TaskPaper, which by design keeps things simple.

However, there is one big difference that has led me to looking at integration: Org-Mode is Emacs based and hence takes ages to launch. TaskPaper on the other hand launches in under a second, and also offers a nice quick entry form that is available system-wide via a a global short-cut key.

Emacs aficionados will protest now – after all – Emacs is meant to be launched and never shutdown! This is true, but in my usage patterns, Emacs does get closed once in a while and having to launch it just to make a few quick Org-Mode entries (even with the excellent remember mode) becomes a pain.

My usage has now become more of the following:

  1. Use TaskPaper as an initial capture mechanism (sort of as a pre-Inbox store). I make heavy use of the quick entry window here
  2. Use a script to collect the TaskPaper entries and reformat them into a Org-Mode compatible file
  3. Append the converted entries into my primary Org-Mode Inbox whenever I have Emacs open

This (for me) provides best of both worlds – quick and ubiquitous data capture, and the power and flexibility of Org-Mode.

The Ruby Conversion Script

Without further ado, the script to convert from TaskPaper to Org-mode is:

#!/usr/bin/env ruby
#
# Converts Taskpaper files to Emacs org-mode files.
#
# Author: Anupam Sengupta, 2010
#
# Distributed under the BSD license (<a href="http://www.opensource.org/licenses/bsd-license.php">http://www.opensource.org/licenses/bsd-license.php</a>)
#
# Usage: From the command line, enter the command:
#
#  ./tpaper2org.rb &lt;taskpaperfilename&gt;
#
# The output is on STDOUT, which can be redirected to an Org-mode file.
# Whether the generated org-mode file should use odd-level prefix stars
# See <a href="http://orgmode.org/manual/Clean-view.html">http://orgmode.org/manual/Clean-view.html</a> for details.
ORG_USES_ODD_LEVELS = false

LINE_PATTERN = /^(\t*)          # Leading tabs
               -                # Followed by a dash (the taskpaper task identifier)
               (.*?)            # The task description
               ((@\w+\s*)*)     # The tags, if any
               $/x

all_tags = Hash.new(0)

Shiftlvl = ORG_USES_ODD_LEVELS ? 2 : 1 # Determine the number of stars to use in Org-mode entries

while (line = gets()):
  line.chomp!
   md = LINE_PATTERN.match(line)          # Match and extract each line
  if md then                                                # ................ A Task line
    tags = md[3].split(/ +/).reject {|tag| “@done” == tag } # get the tags, except @done tags
    tags = [‘’, tags, ‘’].flatten unless tags.empty?
    puts ‘*’ * (1 + Shiftlvl * (md[1].length + 1)) + (line =~ /@done/ ? “ DONE” : “ TODO”) + md[2] + tags.join(‘:’)
    tags.each { |tag| all_tags[tag] += 1} if tags # Keep a list of all tags
  elsif line =~/:$/                               # ................ A project line
    print “* “
    puts line.chomp(“:”)
  else                          # ................ Any other line
    puts line
  end
end

# Lets do a summary of the tags used.
puts &lt;&lt;END
# The tags used till now.
#+TAGS:#{all_tags.keys.sort.join(‘ ‘)}
END

Note that Org-mode supports multiple prefix styles with ‘*’. In particular, the odd-levels versus the odd-even levels is interesting and useful. The script has a ‘ORG_USES_ODD_LEVELS’ global variable that can be set to true if this is the desired export format.

In addition, the script also adds the tags used in the TaskPaper file as a ‘#+TAGS’ entry in the exported org-mode file. You can comment this if this is not required.

The TaskPaper format

The TaskPaper format is simple, and the file (which by default ends with the extension ‘.taskpaper’) is essentially a plain text file that can be opened and edited in any text editor.

The format can be summarized as (from the TaskPaper User’s Guide):

A project is a line ending with a colon:

      A Project:

A task is a line starting with a dash followed by a space:

    - My First Task

A Note is any line that is NOT a project or a task (i.e., does not start with a dash or end with a colon):

    Notes for a task

A tag is any word prefixed with the @ symbol. The tag can optionally have a value in parentheses after the tag name:

      - My First Task @atag @another_tag(1)

Outlining is done by indenting the tasks with tabs:

     - My First Task @atag
         - My sub-level task

Usage

Using the script is simple. Assuming that TaskPaper’s file is named tasks.taskpaper, from the OS X terminal, run the following command:

        $ tpaper2org.rb tasks.taskpaper >> tinbox.org

Where tinbox.org is the destination org-mode file.

This shell command can be put into a cron job or invoked from within Emacs to pull in the tasks as required. You may also want to delete the TaskPaper file (or empty its contents) after this is done, to prevent duplicate entries being imported the next time the Ruby Script is run.

Links

taskpaper.el is an Emacs mode for emulating the TaskPaper interface with support for projects and tasks. The tags support seems to be missing.

Discussion on the Org-Mode mailing list about Taskpaper and Org-Mode.

Advertisement

Musings on my Inbox Zero and GTD workflow

My time-management revolves around email, Calendar and to-do lists. While tools definitely help, it is more important to understand that we are processing information and acting on them, and it is just managing or tracking the items. A few pointers on what I use for Emails:

Email

The newest computer can merely compound, at speed, the oldest problem in the relations between human beings, and in the end the communicator will be confronted with the old problem, of what to say and how to say it.

– Edward R. Murrow

Most of us are inundated with a lot of emails everyday, and the inbox keeps piling up with mails that need to be read and processed. Many of us keep these emails that have not been followed up with an action yet in our default inboxes – or squirrel them away in a maze of folders and sub-folders. Very soon, you land up with hundreds of emails competing for your precious time – and prioritization becomes difficult. This is compounded by the fact that your email inbox is now stuffed with tons of emails – which need to be re-read again before you can decide what to do with them.

However, there is a technique to handle this mess.

  1. Delete Emails! Frankly, a lot of email is never going to be used again, and has dubious value in terms of information content, or are just time-bound communication whose content is going in expire by a certain period. There is absolutely no need to keep these mails lying around and wasting space and time
  2. Never read an email twice. Scan your inbox top to bottom once per read-cycle (more to come on that) and decide the action that this email requires. Most of the time, the action is either:
    • Read and archive (the FYI kind of stuff)
    • Read and respond immediately (anything which requires less than 2 minutes)
    • Read and extract the actionable TODO (e.g. create a report, call some one)
    • Delegate to someone else (you are not the one who should be performing this action)
    • Wait for something else to happen (someone needs to work on an up-stream work item
    • The trick is to ensure that no email slips through the cracks here. You must decide the action and get out of the email reading cycle and actually do what the email triggers as work.
  3. Read email in read-cycles – Turn off the auto-notification every time an email arrives. Set a schedule (say every 45 minutes or an hour) to get into your email client and scan+process your inbox. This will help avoid a lot of distraction and interruption the email system brings
  4. Don’t create more than 5 email folders – Lets be realistic here. How many times were you actually able to retrieve the email you were looking for from the elaborate folder structure you have? Or, think about the frequency of instances where you used the “All Documents/email” view to retrieve that email.
  5. Creating folder structures is really a placebo that feels good while filing away the email but has no other practical value. I use five folders to manage my emails:
    • Action – Emails for which I need to do something that takes longer than 5 minutes
    • Waiting – Emails where someone else is going to provide inputs before I can complete the actionable task
    • Someday – Emails which are really future statements or actions
    • Read/Review – Long announcements, FYIs etc. which take time to read
    • Archive – All my processed emails go here. No hunting around for the right folder to move the email to
  6. Review the Action mail folders at EOD – At end of the day, I scan the action, waiting, someday and the read-review folders to ensure I have NOT missed out on anything for that day
  7. Store the TODO list of actions OUTSIDE the email – An email is a piece of communication, its action should be stored outside – MUAs are not task trackers. A simple text document (with a timestamp and schedule dates) suffices. Your actions and work should be driven via this file, not your inbox

Calendar

How we spend our days is, of course, how we spend our lives.
– Annie Dillard

Calendars are meant for tracking your workday – not just meetings and calls. I block some personal time (in chunks of 30 – 60 min.) every day where I do not schedule meetings or calls. Early morning and late evenings are great for this.

You can also use the recurring event feature to setup reminders for yourself (e.g. “I have to send the status report on 12th of every month”).

Scheduling deadlines are also easy (e.g. “I have to complete the coding on this module by next Thursday”).

Note that the TODO file can also help with tracking these entries, as long as you enter a date against the item.

TODOs

If hard work were such a wonderful thing, surely the rich would have kept it all to themselves.
– Lane Kirkland

Todos are the meat of getting the work done. In essence, todos are the actionable next steps to take something forward. The trick is to ensure that the granularity of tasks and their inter-relationships are managed. In a sense, every TODO is also a mini-project with multiple activities.

As an example, creating a report (of any kind) usually involves:

  1. Ensuring the report meta-data is known (e.g. submission date)
  2. Gathering the data
  3. Analyzing and reformatting the data
  4. Updating the report document
  5. Reviewing the document
  6. Sending out the report, and
  7. Confirming receipt of the report

As you can see, this is a multi-activity TODO, with additional level of granularity possible, along with some scheduling in the calendar. For this example, you can have a Parent TODO for the original task, and child TODOs for the next-level activities in your TODO file. For the maximum impact, assign deadlines and schedules for each of the items (nothing fancy, can be as simple as “This Friday”).The advantage this structuring provides is that

(a) the next step is always known, and
(b) you can be sure of all steps being completed and progress is visible

Another important concept around TODOs is context. To put it simply, some activities can only be done in a certain environment, or using certain tools. They are the ‘meta-tags’ which help you classify what you are doing.

For example, a call needs a Phone, reading email needs a computer or some gizmo that can access the mails; attending an in-person meeting means that you have to be physically in a work place etc.

If you can assign context around your TODOs, you can better utilize those short time-slots that become available throughout the day (e.g. waiting for a meeting to start). To take the earlier example, I would track the context as:

  1. TODO: Create the Report @WORK DEADLINE: This Friday (8/17)
  2. NEXT ACTION Find out the submission date from the boss @ANYWHERE:@CALL (DEADLINE: today)
  3. WAITING Gather the data from my team @EMAIL (DEADLINE: today)
  4. NEXT ACTION Analyse and reformat the data @WORK:@COMPUTER
  5. NEXT ACTION Update the report document @COMPUTER (DEADLINE: tomorrow)
  6. NEXT ACTION Review the document with my boss @WORK (DEADLINE: tomorrow)
  7. NEXT ACTION Send out the report @EMAIL (friday)
  8. NEXT ACTION Confirm receipt of the report @EMAIL or @CALL (friday)

The words prefixed with ‘@’ are the contexts, and help you decide if you can do it right now, or need to wait for the next step. Many of the NEXT ACTIONS can be done parallelly (not in this example though – which is a bit trivial, and too granular). BTW, if you are tracking TODOs at this level, it is better to use a custom tool rather than just plain lists in a spreadsheet. I happen to use the excellent Org-Mode mode for Emacs – though there are quite a few custom applications built for this purpose and more which do just that.

In fact, the task-tracking genre seems to be a a very popular software category on all platforms – with all the bells and whistles you could wish for. Do play around with the tool of your choice for a few days though before locking down on the one that fits your work-cadence. After all, it is one application that will be used the most through out your day.

Conclusion

One man’s religion is another man’s belly laugh.
– Robert A. Heinlein

These are some of the techniques I use on a daily basis to gain control on the constant stream of information and the seemingly chaotic and unplanned work that seems to turn up. It does work for me, though is definitely a custom tailored workflow that may not suit everyone.

Do let me know what you think, and how you bring in sanity to your work day!

Further Reading

  1. http://inboxzero.com – Inspiration for most of the mail related tips and workflow
  2. Getting Things Done – The Art of Stress-free productivityThe book for learning GTD methods
  3. ATPO – A comprehensive list of outliners and to-do trackers for the Mac
  4. Org-Mode – The all-in-one note taking, calendaring and everything-else outliner for Emacs