This is the code that I use with planner.el to organize
events. All my events require a set of tasks to be done, and these tasks need
to be scheduled a certain amount of time before each event. This function
schedules all of the tasks on the proper days, based on the interval in days
you give to each task in the list (like -21 in my fictitious tasks below)
relative to the date you enter for the event when prompted, and associates each
task with a project page named by your answer to the Event ID prompt. If you
are running behind, and it is already, for example, only 15 days before the
event, then all the tasks with an interval greater than 15 will be scheduled
for today. Also, all of the tasks in the fixed-tasks list will be
scheduled for today.
Though I use this for planning events, it seems like it would be useful for planning any kind of project where the tasks associated with it are predictable.
I have no idea if the (with-emacs-wiki-project bit is necessary or
not. Of course, please backup your plan files before trying this out. It works
for me, but I'm a definite amateur.
(defun john/planner-make-event (event-id start-date)
(interactive (list (read-string "Enter Event ID: ")
(planner-read-date)))
(with-emacs-wiki-project "WikiPlanner"
(loop with today = (planner-filename-to-calendar-date (planner-today))
with task-list = '((-21 "Reserve the space.")
(-21 "Order the materials.")
(-21 "Post event on calendar.")
(-14 "Do we have all the information we need for this event?")
(-8 "Send travel information to the event contacts")
(-21 "Did we receive answers to the usual questions?"))
for task in task-list
for days-before-event = (nth 0 task)
for title = (nth 1 task)
for date = (planner-calculate-date-from-day-offset start-date days-before-event)
for task-date = (if (time-less-p (planner-filename-to-calendar-date date) today)
(planner-date-to-filename today)
date)
do (planner-create-task title task-date nil event-id))
(loop with fixed-task-list = '("Tasks that start now go here.")
for fixed-task in fixed-task-list
do (planner-create-task fixed-task (planner-today) nil event-id))))