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

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

[emacs-wiki-discuss] planner-gtd.el -- (very) rough beginnings


From: Mark Simpson
Subject: [emacs-wiki-discuss] planner-gtd.el -- (very) rough beginnings
Date: Mon, 07 Nov 2005 18:54:07 -0500
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)

I have been giving some thought as to what i need planner to do to
support my use of the GTD methodology, and last night i started to
implement it.  Below is my very rough start at planner-gtd.el which
will hopefully be a useful to some in the planner community, at least
as an example of the flexibility of the system.

Caveat Downloador: As i said it is rough and not nearly complete.  If
it eats all your tasks (as it nearly did for me...) quickly make a new
task to do a restore from you backups; or if you don't have one make a
task to implement one soon.

Please send me you comments/criticisms/bug reports

--------------------

;;; planner-gtd.el --- GTD support for planner mode.

;;; Copyright (C) 2005 -- Mark Simpson <address@hidden>

;; Author: Mark Simpson <address@hidden>
;; Created: 2005-11-06
;; Time-stamp: <2005-11-07 18:53:55 damned>
;; Keywords: planner
;; Version: 

;; This file is not part of XEmacs, or GNU Emacs.

;; This library is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; It is distributed in the hope that it will be useful, but WITHOUT
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
;; License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this library; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
;; 02111-1307, USA.

;;;
;;; Commentary:
;;;
;;
;; This file attempts to make planner mode more in tune with the style
;; of planning as laid out by David Allen in 'Getting Things Done'
;;
;; To do this it:
;; * removes the use of day pages
;; * promotes the use of plan pages for a) Projects and b) contexts
;; * promotes the use of a single page for all next actions
;;   sub-divided by contexts
;; * TODO: promotes the use of remember mode for 'collection'
;; * TODO: Provides 'tickler' file functionality.
;;

;;;
;;; Requirements
;;;
(require 'cl)
(require 'planner)
(require 'planner-multi)
(require 'planner-trunk)

;;;
;;; Planner GTD defintions
;;;

;; GTD doesn't use 'day pages'.  The calendar should be used for
;; things that MUST happen on a particular day.
(setq planner-use-day-pages nil)

;;
;; Need to redefine planner-today to use the variable
;; *planner-welcome-page*
;; This page is intended to be the 'next action' list.x
(defvar *planner-welcome-page* "NextActions")
(defun planner-today () 
  "Return the file of the current date; or the 'main page' if day
pages are not used."
  (if planner-use-day-pages
      (or planner-timewarp-date 
          (planner-date-to-filename 
           (decode-time (current-time))))
    *planner-welcome-page*))

;;
;; set the planner-trunk-rule-list to recognize contexts
;;
(defvar *planner-gtd-context-regexp* "@.*")
(defvar *planner-gtd-context-list* '("@home" "@web" "@laptop" "@shopping"))
(setq planner-trunk-rule-list 
      `((,*planner-welcome-page*
         nil
         ,(mapcar #'(lambda (c) (list c c)) *planner-gtd-context-list*))))


(defvar *planner-gtd-default-context* nil)

;;
;; Ensure that every task when created is in the NextActions page
;;
(setq planner-multi-copy-tasks-to-page *planner-welcome-page*)
(defun planner-gtd-read-name (file-alist prompt initial)
  "Call planner-multi-read-name to read the projects, repeat for the
contexts, concatenate these together with the *PLANNER-WELCOME-PAGE*."
  (let ((plan-pages (remove-if 
                     #'(lambda (a) (or 
                                    (string-match "@.*" (car a))
                                    (string=
                                     *planner-welcome-page*
                                     (car a))))
                     file-alist))
        (context-pages (remove-if-not 
                        #'(lambda (a) (string-match "@.*" (car a)))
                        file-alist)))
    (let ((plans 
           (planner-multi-split 
            (planner-multi-read-name plan-pages prompt initial)))
          (contexts 
           (planner-multi-split
            (planner-multi-read-name context-pages "Contexts:" nil))))
      (mapconcat 'identity (append contexts plans) planner-multi-separator))))

(setq planner-read-name-function #'planner-gtd-read-name)

;; Make sure trunk-ing happens
(add-hook 'planner-create-task-hook #'planner-trunk-tasks)

;; Move completed tasks to another page
(defvar *planner-gtd-completed-tasks-page* "CompletedTasks")
(defun planner-gtd-mark-task-hook (old-status new-status)
  (when (or (string= new-status "C")
            (string= new-status "X"))
    (let* ((info (planner-current-task-info))
           (links (planner-multi-task-link-as-list info))
           (new-links 
            (append 
             (list *planner-gtd-completed-tasks-page*)
             (remove-if #'(lambda (l) (or (string= *planner-welcome-page* 
                                                   (planner-link-base l))
                                          (string-match "@.*" 
                                                        (planner-link-base l))))
                        links))))
      (planner-multi-replan-task (planner-multi-make-link new-links)))
    (planner-trunk-tasks)))

;;; commented out because it doesn't work correctly yet!
;;; ;; planner-multi-remove-task-from-pool is added by loading planner-multi
;;; (remove-hook 'planner-mark-task-hook 'planner-multi-remove-task-from-pool)
;;; ;; add our hook instead.
;;; (add-hook 'planner-mark-task-hook 'planner-gtd-mark-task-hook)



(provide 'planner-gtd)





reply via email to

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