1

I'm finding TODO lists in org-mode incredibly useful. For example, say I have a task to send an email, I define the following sequence in my init.el file:

;; Sequence in TODO list
(setq org-todo-keywords
      '((sequence "EMAIL" "SENT" "|" "RESPONSE" "CANCELLED")))

Once the email is sent, I switch it from EMAIL to SENT and then to RESPONSE when I get an email back. Great! And I can timestamp the RESPONSE like so:

;; Timestamp on completed tasks 
(setq org-log-done 'time)   

Now, I'd like to extend this further, so that I get a timestamp for SENT, which I can do by shifting "|" to the left of SENT. But when I toggle to RESPONSE, I don't get a new timestamp because the task is already closed.

Is there a way to get timestamps that persist for multiple states of a TODO list item (i.e., for both SENT and then RESPONSE)?

1
  • Do C-h i g (org)Tracking TODO state changes RET for the doc.
    – NickD
    Feb 19, 2021 at 14:54

1 Answer 1

3

Instead of just rely on the done/not done state, you can specify for each task if you should record a timestamp on entering/leaving it. The relevant bit from C-h v org-todo-keywords is

Each keyword may also specify if a timestamp or a note should be recorded when entering or leaving the state, by adding additional characters in the parenthesis after the keyword. This looks like this: "WAIT(w@/!)". "@" means to add a note (with time), "!" means to record only the time of the state change. With X and Y being either "@" or "!", "X/Y" means use X when entering the state, and use Y when leaving the state if and only if the target state does not define X. You may omit any of the fast-selection key or X or /Y, so WAIT(w@), WAIT(w/@) and WAIT(@/@) are all valid.

So

(setq org-todo-keywords
      '((sequence "EMAIL" "SENT(!)" "|" "RESPONSE(!)" "CANCELLED")))

Will record a timestamp when the state becomes SENT or RESPONSE

Your Answer

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

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