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

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

[emacs-wiki-discuss] [PATCH] Fix planner-multi problems with single-link


From: Sergey Vlasov
Subject: [emacs-wiki-discuss] [PATCH] Fix planner-multi problems with single-linked tasks
Date: Sat, 3 Sep 2005 22:14:33 +0400

Hello!

The current planner-multi code has some problems when handling
"old-style" tasks (with only a single link):

 - planner-multi-update-task does not work correctly when the task
   does not yet exist on the other page and needs to be added there
   (it adds a completely identical copy of the task, instead of
   changing the link to point back to the current page).  Calling
   planner-update-task-basic directly does the right thing for such
   tasks.

 - planner-multi-edit-task-description corrupts the single-linked task
   on the other page (again, it inserts an identical copy of the task
   without replacing the link with the back pointer).

Looks like planner-multi-update-task tries to preserve the old
planner behavior for tasks which have only one link:

  (let* ((info (planner-current-task-info))
         (links (planner-multi-task-link-as-list info)))
    (if (<= (length links) 1)
        (planner-update-task-basic)
      ... code for the multiple links case ...

However, with the current code the condition (<= (length links) 1) can
never be true, because planner-multi modifies the behavior of
planner-task-info-from-string to make it always add the current page
name to the list of links.  Because of this, planner-update-task-basic
is never called, and the rest of planner-multi-update-task code does
not work correctly for tasks with a single link.

planner-multi-edit-task-description has the same broken condition too.
Another copy of such condition is in planner-delete-task, however, in
this case it does not seem to break anything (but I still fixed it).

Here is the patch which fixes the checks for single-linked tasks:

--- planner/planner-multi.el.single-link        2005-08-31 23:07:08 +0400
+++ planner/planner-multi.el    2005-09-03 22:06:16 +0400
@@ -356,7 +356,7 @@ to update the task description, see plan
   (interactive)
   (let* ((info (planner-current-task-info))
          (links (planner-multi-task-link-as-list info)))
-    (if (<= (length links) 1)
+    (if (<= (length links) 2)
         (planner-update-task-basic)
       ;; Jump around
       (with-planner-update-setup
@@ -404,7 +404,7 @@ description, and links."
     (let ((info (planner-current-task-info))
           links)
       (setq links (planner-multi-task-link-as-list info))
-      (if (<= (length links) 1)
+      (if (<= (length links) 2)
           ad-do-it
         (while links
           (planner-find-file (planner-link-base (car links)))
@@ -528,7 +528,7 @@ Create task on multiple pages if necessa
            new-task)
        (setq new-task (planner-format-task info nil nil nil description))
        (let ((links (planner-multi-task-link-as-list info)))
-         (if (<= (length links) 1)
+         (if (<= (length links) 2)
              (planner-edit-task-description-basic description)
            ;; Jump around
            (while links

-- 
Sergey Vlasov

Attachment: pgpue9sWf6iun.pgp
Description: PGP signature


reply via email to

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