[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[emacs-wiki-discuss] Re: Making one task dependent on another.
From: |
Sacha Chua |
Subject: |
[emacs-wiki-discuss] Re: Making one task dependent on another. |
Date: |
Sat, 20 Aug 2005 10:56:18 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux) |
Alex Polite <address@hidden> writes:
> Is there a way (in muse or emacs-wiki) to make one task dependent on
> another? I've have a lot of tasks that shouldn't be displayed until
> some other task (that they depend upon) is completed.
I usually make them undated tasks on the project page. I have some
code to automatically schedule the next unscheduled task from the
project when I complete a task. That fakes dependencies a bit
and also neatly supports GTD's next actions.
;;_+ Schedule next undated task from same project
(defun sacha/planner-seek-next-unfinished-and-undated-task ()
"Move point to the next unfinished task on this page.
Return nil if not found, the task if otherwise."
(interactive)
(let (task-info)
(while (and (not task-info)
(re-search-forward "^#[A-C][0-9]*\\s-+[^CX]\\s-+" nil t))
(setq task-info (planner-current-task-info))
(when (planner-task-date task-info) (setq task-info nil)))
task-info))
(defun sacha/planner-queue-next-task (&optional task-info)
"Schedule the next task for TASK-INFO or the current task for today."
(interactive)
(save-window-excursion
(save-excursion
(setq task-info (or task-info (planner-current-task-info)))
(when (and task-info (planner-task-plan task-info))
(planner-find-file (planner-task-plan task-info))
(goto-char (point-min))
(if (sacha/planner-seek-next-unfinished-and-undated-task)
(planner-copy-or-move-task (planner-today))
(message "No more unscheduled tasks for %s."
(planner-task-plan task-info)))))))
(defun sacha/planner-schedule-next-task (old-status new-status)
"Schedule next task if there are no other unfinished tasks for this project."
(when (and (string= new-status "X")
(not (string= old-status "X")))
(let ((task-info (planner-current-task-info))
(not-seen t))
(when (and task-info
(planner-task-plan task-info)
(planner-task-date task-info))
(save-window-excursion
(save-excursion
(when (string= (planner-task-plan task-info)
(planner-task-page task-info))
(planner-jump-to-linked-task))
(goto-char (point-min))
(while (and not-seen
(re-search-forward "^#[A-C][0-9]*\\s-+[^CX]\\s-+" nil
t))
(let ((current (planner-current-task-info)))
(when (string= (planner-task-plan task-info)
(planner-task-plan current))
(setq not-seen nil))))))
(when not-seen
(sacha/planner-queue-next-task task-info)))))
t)
(add-hook 'planner-mark-task-hook 'sacha/planner-schedule-next-task)
--
Sacha Chua <address@hidden> - open source geekette
http://sacha.free.net.ph/ - PGP Key ID: 0xE7FDF77C
interests: emacs, gnu/linux, personal information management, juggling
sachac on irc.freenode.net#emacs . YM: sachachua83