0

I want to change the TODO state of a task automatically on a give date. I would expect something like this:

* FUTU Some task that only becomes actionable of a given date
:PROPERTIES:
:ACTIONABLE: some-function(<timestamp>, TODO)
:END:

This block should automatically change the task to a TODO state once the date is reached. Is there a package that can do this?

Regards,

2 Answers 2

2

Not a direct answer, but I would generally use scheduling (org-schedule, C-c C-s) combined with an agenda view for this sort of workflow. The default agenda view will not include any tasks scheduled for a future date. On that date the item will start to appear.

This provides a built in way to set the date when you want a task to start showing up in your daily todo list (or GTD review view, etc).

Note that org-mode has different kinds of timestamps with different semantics, see https://emacs.stackexchange.com/a/10506/780. Your task might have a deadline as well as a scheduled time when you want to start thinking about it. (For more detail see Deadlines and Scheduling in the org manual.)

2
  • Thanks for the answers. This is similar to what I'm doing at the moment, but I'm looking for a lees manual solution to change the TODO state Apr 29, 2020 at 13:55
  • I wrote a function to modify the TODO state and properties of future tasks. It might be useful for your workflow. Apr 30, 2020 at 20:13
0

I ended up writing a small functions for this purpose

(defun j/org-evaluate-if-actionable ()
  "Returns t if the task at point is actionable or nil if it isn't"
  (and (org-entry-get (point) "ACTIONABLE")
       (string< (org-read-date nil nil (org-entry-get (point) "ACTIONABLE"))
                    (org-read-date nil nil "+0"))))

(defun j/org-process-task ()
    "Vefifies if a task is actionable. If it is, set it as actionable"
    (message "PROPIEDAD: %s" (stringp (org-entry-get (point) "ACTIONABLE")))
    (message "Tarea: %s" (org-entry-get (point) "ITEM"))
    (message "Accionable: %s:" (j/org-evaluate-if-actionable))
    (when (j/org-evaluate-if-actionable)
           (org-todo "TODO")
           (org-delete-property "ACTIONABLE")))

(defun j/org-verify-actionable-tasks ()
  "Goes through al agenda files checking if FUTU tasks are actionable"
  ;(interactive)
  (org-map-entries
   '(j/org-process-task)
   "/+FUTU" 'agenda))

;; Ejecutar j/org-verify-actionable-tasks cada vez que se corra la agenda. Lo hace antes de que se calcula le agenda.
(add-hook 'org-agenda-mode-hook #'j/org-actionable)
(defun j/org-actionable ()
  (j/org-verify-actionable-tasks))

This function will find tasks with a FUTU TODO state and an ACTIONABLE property prior to today. Then, it changes the TODO state to TODO and removes the ACTIONABLE property. For example, this task

* FUTU Some task
  :PROPERTIES:
  :ACTIONABLE: [2020-04-29]
  :END:  

Will look like this after the date set in actionable ACTIONABLE:

* TODO Some task
2
  • How are you creating the ACTIONABLE date, or are you doing this manually via C-c C-x p? I'm curious why you think this is faster than scheduling your entries to some future date.
    – jagrg
    Apr 30, 2020 at 21:15
  • @jagrg It isn't faster (in fact, it's a bit slower, but nothing tha can't be fixed with a bit of elisp). I use it because, in my workflow, I need to distinguish between tasks that can be done (with TODO state) and tasks that I register but are on hold until a certain date or condition (with FUTUstate). The function is to automatically change the FUTU tasks into TODO state once the actionable date comes. It might be overly complicated, but works for me Apr 30, 2020 at 22:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.