Is there a mechanism in org-mode to programmatically extract all TODO keyword/state change information from a heading? For example with the following:

* DONE Test
- State "DONE"       from "CANCELED"       [2017-10-20 Fri 15:50]
- State "CANCELED"   from "WAIT"       [2017-10-20 Fri 15:33]
- State "WAIT"       from "TODO"       [2017-10-20 Fri 15:14] \\
- State "TODO"       from "WAIT"       [2017-10-20 Fri 15:14]
- State "WAIT"       from "TODO"       [2017-10-20 Fri 15:11] \\
  Waiting for something

Obtain a list of alists/plists- each with the old-state, new-state, timestamp string, and the possibly multiline note. If not- what would be a robust approach to do so?

Some observations:

  1. A close relation to these state changes are clocking entries, but they follow a different structure. Are there other similar such entries used elsewhere in org-mode?
  2. State entries may be intermixed with clock entries- at least.
  3. There is commonly variation in indentation.
  4. State and clock entries may optionally be constrained to drawers (per the org-log-into-drawer and org-clock-into-drawer values).
  5. A drawer is probably necessary to unambiguously extract a final note value.

If the format is used by org-mode for encoding other types of information a more generalized solution would be fine.

Your Answer

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

Browse other questions tagged or ask your own question.