emacs-wiki-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[emacs-wiki-discuss] Planenr snippet: count tasks in page


From: Chris Parsons
Subject: [emacs-wiki-discuss] Planenr snippet: count tasks in page
Date: Wed, 20 Jul 2005 11:32:12 +0100
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Hi all

I put together this little function that might be useful. I've
implemented a "Gtd" master page containing all my Gtd contexts
(GtdAtComputer, GtdHome, etc, and I thought it'd be useful instead of
heading into each page everytime to show a quick overview of the tasks
on any page on the master page. I'm sure people can think of other uses.

To use, copy/paste this code snippet into your .emacs:

,----
| (defun chrismdp/planner-count-tasks(page &optional status priority)
|       (interactive)
|       (length
|        (planner-extract-tasks
|        (list page)
|        (lambda(task)
|                (and
| (if status (equal (planner-task-status task) status) t)
| (if priority (equal (planner-task-priority task) priority) t))))))
`----

... and add the following into your referring page (or something like it):

GtdAtComputer (<lisp>(chrismdp/planner-count-tasks "GtdAtComputer"
"_")</lisp> open tasks, <lisp>(chrismdp/planner-count-tasks
"GtdAtComputer" "_" "A")</lisp> high priority)
GtdHome (<lisp>(chrismdp/planner-count-tasks "GtdHome" "_")</lisp> open
tasks, <lisp>(chrismdp/planner-count-tasks "GtdHome" "_" "A")</lisp>
high priority)

This, for me, gives the following:

GtdAtComputer (31 open tasks, 0 high priority)
GtdHome (10 open tasks, 0 high priority)

Now I can see where the important tasks are, and when I'm trawling for
stuff to do I don't even bother opening a page unless there's something
on it.

Hope this is useful to someone. If you'd like to improve on the code,
please paste any changes back to the list.

Thanks!
Chris

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]