I work with emacs 22.0.50.1 on Windows XP - so some of my elisp may be
at odds with your environment.
Completing a task (or cancelling) results it being planner-multi
assigned to the current day (in addition to the current project page).
So I accomplished this with this burp of elisp...
(defun eej/planner-track-finished-tasks (old-status new-status)
"Automatically reschedule tasks onto today before marking them as done.
Adds this to `planner-mark-task-hook'."
(if (and (null (string-match planner-date-regexp (buffer-name)))
(or (string= new-status "X")
(string= new-status "C")))
(planner-copy-or-move-task (planner-today) t)))
(add-hook 'planner-mark-task-hook 'eej/planner-track-finished-tasks)
On top of this - I have crazy logic that makes the completed/cancelled
tasks invisible so they don't clutter up the project page. But only
for tasks that are older than a few days.
And for that - I have this. My task matching regexp could probably be
replaced by muse provided constants. I'll warn you - this has many
weird quirks. And I bet this trips up different versions of emacs and
xemacs in weird ways. Caveat emptor!
(require 'time-date)
(require 'timezone)
(defcustom eej/planner-hide-completed-tasks-regexp
(concat "^#[A-C][0-9]*\\s-+[XC].*(.*"
"\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\).*" "$")
"Locates completed tasks and picks up their completion date as well")
(defcustom eej/planner-hide-completed-tasks-days 3
"Number of days to that completed tasks will remain visible")
(defun eej/planner-hide-completed-tasks (beg end verbose)
(goto-char beg)
(while (re-search-forward eej/planner-hide-completed-tasks-regexp end t)
(let ((a (match-beginning 0))
(b (match-end 0)))
(if (>
(days-between (current-time-string)
(timezone-make-arpa-date
(string-to-int (buffer-substring-no-properties
(match-beginning
1) (match-end 1)))
(string-to-int (buffer-substring-no-properties
(match-beginning
2) (match-end 2)))
(string-to-int (buffer-substring-no-properties
(match-beginning
3) (match-end 3)))
12)) ;noon seemed like a good hour
eej/planner-hide-completed-tasks-days)
(put-text-property a (1+ b) 'invisible 'completed)))))
(setq line-move-ignore-invisible t)
;; and then drop the following line into your planner-mode-hook
function if you have one.
(add-hook 'muse-colors-buffer-hook 'eej/planner-hide-completed-tasks t)
If not - you can use this skeleton.
(defun eej/planner-mode-hook-impl ()
(add-hook 'muse-colors-buffer-hook 'eej/planner-hide-completed-tasks t))
(add-hook 'planner-mode-hook 'eej/planner-mode-hook-impl)
-Eric
_______________________________________________
Planner-el-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/planner-el-discuss