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

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

Re: [emacs-wiki-discuss] Re: Questions regarding planner-trunk


From: Wei-Hao Lin
Subject: Re: [emacs-wiki-discuss] Re: Questions regarding planner-trunk
Date: Thu, 24 Nov 2005 12:07:20 -0500

On 11/24/05, Sacha Chua <address@hidden> wrote:
> Seth Falcon <address@hidden> writes:
>
> > It would be neat to have a planner-trunk like functionality that
> > matched on the entire task description, not just the plan pages.  Then
>
> Does this do the trick?

very close,

> (defun planner-trunk-sort-tasks (rule)
>   "Sort tasks by plan name according to the given RULE list."
>   (let* ((trunk-list (planner-trunk-rule-trunk-sections rule))
>          (completed-heading (planner-trunk-rule-completed-heading rule))
>          (task (buffer-substring-no-properties
>                 (planner-line-beginning-position)
>                 (planner-line-end-position)))
>          (trunk-count (length trunk-list))
>          (task-completed (planner-trunk-completed-p 
> (planner-current-task-info))))
>     (if (not plan)

plan is not defined here.  I put the following back in the let* variable list,

(plan (planner-trunk-task-plan-str task-info))

Besides planner-trunk-sort-tasks, planner-trunk-do-trunk-section has
to be changed accordingly (plan -> task)

(defun planner-trunk-do-trunk-section (rule)
 "Really do the trunk.

Adds new lines and optionally outline mode subheadings according to
the trunk RULE.  Point must be at the beginning of the section to
trunk, typically either the beginning of the tasks section or the
beginning of the completed subsection."
 (let ((not-done t)
       (completed-hdr (planner-trunk-rule-completed-heading rule))
       ;; Following adds a dummy first entry to get rid of special
       ;; case to handle headings otherwise.  It prevents anyone from
       ;; having a plan page named (_-), which I hope no-one wants to
       ;; do...
       (trunk-list (cons "^\\\\(_-\\\\)$"
                         (planner-trunk-rule-trunk-sections rule)))
       (first-trunk (car (planner-trunk-rule-trunk-sections rule)))
       (ntasks 0))
   (while (and trunk-list not-done)
     (let ((task-info (planner-current-task-info)))
       (when task-info
         (setq ntasks (1+ ntasks))
         (let ((plan (planner-trunk-task-plan-str task-info))
               (task (buffer-substring-no-properties
                      (planner-line-beginning-position)
                      (planner-line-end-position)))
               (plan-regexp (planner-trunk-list-regexp (car trunk-list))))
;;             (unless (string-match plan-regexp plan)
           (unless (string-match plan-regexp task)
             (let ((hdr nil))
               (while (and trunk-list
;;                             (not (string-match plan-regexp plan)))
                           (not (string-match plan-regexp task)))
                 (setq trunk-list (cdr trunk-list))
                 (setq plan-regexp
                       (planner-trunk-list-regexp (car trunk-list)))
                 (when (planner-trunk-list-heading (car trunk-list))
                   (setq hdr
                         (planner-trunk-list-heading (car trunk-list)))))
               (when (planner-trunk-list-heading (car trunk-list))
                 (setq hdr (planner-trunk-list-heading (car trunk-list))))
               (planner-trunk-ins-heading completed-hdr task-info hdr)))))
       (when (or (null trunk-list)
                 (not (equal 0 (forward-line 1)))
                 (and completed-hdr
                      (not (planner-trunk-completed-p task-info))
                      (planner-trunk-completed-p (planner-current-task-info))))
         (setq not-done nil))))
   ntasks))

reply via email to

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