9

Rather than manually check a tickler file or calendar every morning, how can I create a trigger that will set the status of an item to TODO on a certain date?

5

Not a direct answer but you could use Org's support for deadlines and scheduling instead.

You can create your TODO items and give them a scheduled date, which in Org means the date you plan to do the task -- and when it should start showing up in your agenda. (If you aren't already using org agenda views they are worth some investigation!)

Depending on your needs you can also assign a deadline. For example: create a TODO on Friday, schedule it for the following Wed when you actually want to see it; and give it a deadline for the following Friday by which it must completed.

7

Here is something I use every morning to comb through all of my todo and change the date to today if it is overdue, and change it from next-action to active if it is due today. It is a custom solution for my own calendar that I've been using for a year, so it will undoubtedly need some customization on your own part. My recollection is that there was a change in org-deadline from org-mode version 7 and 8, and I may be using a previous version in my setup. The current version may need an additional argument or something -- if you need additional help, let me know and I'll work on it over the next few days as time permits.

The regex that I use contemplates the headings have two stars and will be at the flush-left of the buffer. Your own setup will likely require a modification of the regex.

(defun org-carry-forward-uncompleted-tasks ()
"Carry forward uncompleted tasks."
(interactive)
  (save-excursion
    (goto-char (point-max))
    (while (re-search-backward "^\\*\\* Active" nil t)
      (unless (org-at-heading-p)
        (org-back-to-heading t))
      (let* (
          (element (org-element-at-point))
          (todo-state (org-element-property :todo-keyword element))
          (deadline (org-element-property :deadline element))
          (deadline-time-stamp
            (when deadline
              (time-to-days
                (org-time-string-to-time
                  (org-element-property :raw-value deadline)))))
          (today (time-to-days (current-time))) )
        (when
            (and
              deadline-time-stamp
              (> today deadline-time-stamp) ;; deadline is overdue
              (string= todo-state "Active") ) ;; todo-state equals "X"
          (org-deadline nil ".") )))))

(defun org-make-active-today ()
"Change task from Next Action to Active if deadline is less than or equal to today."
(interactive)
  (save-excursion
    (goto-char (point-max))
    (while (re-search-backward "^\\*\\* Next Action" nil t)
      (unless (org-at-heading-p)
        (org-back-to-heading t))
      (let* (
          (element (org-element-at-point))
          (todo-state (org-element-property :todo-keyword element))
          (deadline (org-element-property :deadline element))
          (deadline-time-stamp
            (when deadline
              (time-to-days
                (org-time-string-to-time
                  (org-element-property :raw-value deadline) ))))
          (today (time-to-days (current-time))) )
        (when
            (and
              deadline-time-stamp
              (>= today deadline-time-stamp) ;; deadline less than or equal to today
              (string= todo-state "Next Action")) ;; todo-state equals "X"
          (org-deadline nil ".")
          (org-todo "Active") )))))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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