[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [emacs-wiki-discuss] Re: Trying to write code to move a task to a Co
From: |
Jim Ottaway |
Subject: |
Re: [emacs-wiki-discuss] Re: Trying to write code to move a task to a CompletedTask page when completed |
Date: |
Sun, 20 Nov 2005 17:37:20 +0000 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
>>>>> Mark Simpson <address@hidden> writes:
> Thanks, your fix did the trick... part-way. If my task is on one page
> only then it removes it from that page and adds it to CompletedTasks.
> But if it is on two pages then it ends up on all three. I'll debug
> this a bit more. My gut feeling is that it may have to do with the
> distinction between link strings and page names. I may be trying to
> string= between the two types instead of normalizing to page names
> before comparing.
> Thanks again!
Yes. My guess is that the bit I have underlined is not correct
(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)
since each of links from planner-multi-task-link-as-list will be
wrapped in explicit link brackets, the remove won't match anything.
It should probably be something like
(new-links (append (planner-multi-link-delete links)...
I also don't think you need to do the (mapconcat 'identity... part
after that, since if the argument to planner-multi-replan-task is a
string it is just split into a list again.
None of this is tested!
Regards,
--
Jim Ottaway