4
votes

I use org-mode to manage some deadlines for repeated tasks. For example, I may have something like the following:

* TODO My Weekly Task
  DEADLINE <2013-08-10 Sat +1w>

If I mark the task as DONE, then the deadline automatically increments to the next week as expected. However, I also like to use the SCHEDULED time to indicate when during the week I would like to actually do that task, for example:

* TODO My Weekly Task
  DEADLINE <2013-08-10 Sat +1w> SCHEDULED: <2013-08-08 Thu>

This makes the task show up in the agenda for today (Thursday). However when I mark the task DONE, I end up with the following:

* TODO My Weekly Task
  DEADLINE <2013-08-17 Sat +1w> SCHEDULED: <2013-08-08 Thu>

...and the task still appears in the agenda view for today, even though it has been completed.

Is it possible, for tasks that have a repeated DEADLINE, to get Org-Mode to clear the non-repeated SCHEDULED date?

1

1 Answers

5
votes

Here's the patch, if you want to apply it yourself. I'll send another copy to the org-mode mailing list.

--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12835,7 +12835,8 @@ This function is run automatically after each state change to a DONE state."
    (setq type (if (match-end 1) org-scheduled-string
             (if (match-end 3) org-deadline-string "Plain:"))
          ts (match-string (if (match-end 2) 2 (if (match-end 4) 4 0))))
-   (when (string-match "\\([.+]\\)?\\(\\+[0-9]+\\)\\([hdwmy]\\)" ts)
+   (if (not (string-match "\\([.+]\\)?\\(\\+[0-9]+\\)\\([hdwmy]\\)" ts))
+       (org-remove-timestamp-with-keyword org-scheduled-string)
      (setq n (string-to-number (match-string 2 ts))
        what (match-string 3 ts))
      (if (equal what "w") (setq n (* n 7) what "d"))