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

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

[emacs-wiki-discuss] Re: Summary of unscheduled tasks


From: Sacha Chua
Subject: [emacs-wiki-discuss] Re: Summary of unscheduled tasks
Date: Thu, 02 Dec 2004 08:40:15 +0900
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux)

Jody Klymak <address@hidden> writes:

Here you go. =) Found myself with a bit of spare time between
breakfast and class. This took me around 10 minutes to hack in.
(Sorry, wasn't using timelog to track the exact time...)

It schedules the next task for today if there are no more unfinished
tasks for the same project on today's page. Should work from both plan
and day pages.

I think sacha/planner-seek-next-unfinished-and-undated-task will also
be useful for ajk. It returns non-nil if there is actually an
unfinished and undated task.

> What I have been thinking of, and is perhaps now hackable with Sacha's
> task database, is actual queues of tasks.  i.e. in Getting things

;; For Jody Klymak
(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)))))))

(defadvice planner-task-done (after sacha activate)
  "Schedule next task if there are no other unfinished tasks for this project."
  (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)))))

-- 
Sacha Chua <address@hidden> - open source geekette
http://sacha.free.net.ph/ - PGP Key ID: 0xE7FDF77C
interests: emacs, gnu/linux, personal information management, CS ed
applying as a Debian new maintainer | looking for a grad school




reply via email to

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