|
From: | Mark Simpson |
Subject: | [emacs-wiki-discuss] Trying to write code to move a task to a CompletedTask page when completed |
Date: | Sat, 19 Nov 2005 20:53:11 -0500 |
User-agent: | Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) |
For my planner-gtd.el project i am trying to move tasks off of the 'NextAction' plan page where everything lives to a 'CompletedTasks' plan page. I am trying to do this by writing a hook function for planner-mark-task-hook. But it doesn't seem to be working. It removes the task from NextActions just fine but is not adding it to CompletedTasks. Perhaps something is going wrong because i am trying to do this in a hook function? Perhaps i should be using an after advice function on planner-mark-task? When i debug this it looks like planner-replan-task (which is an alias for planner-multi-replan-task since i have loaded planner-multi) is removing the task but it never adds it to the new page. Any help will be greatly appreciated. Here is the code i am trying to use: -------------------- (defvar planner-welcome-page-name "NextActions") (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 (remove planner-welcome-page-name links) (list (planner-make-link planner-gtd-completed-tasks-page))))) (save-excursion (planner-replan-task (mapconcat 'identity new-links planner-multi-separator))) (when (string= (planner-page-name) planner-welcome-page-name) (planner-find-file (car new-links)) (planner-find-task info)))) nil) (remove-hook 'planner-mark-task-hook 'planner-multi-remove-task-from-pool) (add-hook 'planner-mark-task-hook 'planner-gtd-mark-task-hook t) --------------------
[Prev in Thread] | Current Thread | [Next in Thread] |