emacs-orgmode
[Top][All Lists]
Advanced

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

[O] Clear non-repeated scheduled time when deadline is repeated


From: Phil Chrapka
Subject: [O] Clear non-repeated scheduled time when deadline is repeated
Date: Sun, 27 Jul 2014 17:02:53 -0400

Hi, 
I'm having the exact same issue as this question on stackoverflow http://stackoverflow.com/questions/18123972/emacs-org-mode-clear-non-repeated-scheduled-time-when-deadline-is-repeated and I've copied it below.

The solution provided to the question modifies the source, which I'd like to avoid if possible. Is there a better way of doing this like by setting a variable or a hook? Or does anyone have better ideas about this type of workflow?

Question:
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?

Solution:
--- 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")) 

Thanks,
Phil

reply via email to

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