- publishing free software manuals
The Org Mode 7 Reference Manual
by Carsten Dominik and others
Paperback (6"x9"), 282 pages
ISBN 9781906966089
RRP £9.95 ($14.95)

Sales of this book support the Org project! Get a printed copy>>>

5.3.2 Tracking TODO state changes

When TODO keywords are used as workflow states (see section 5.2.1 TODO keywords as workflow states), you might want to keep track of when a state change occurred and maybe take a note about this change. You can either record just a timestamp, or a time-stamped note for a change. These records will be inserted after the headline as an itemized list, newest first.(41) When taking a lot of notes, you might want to get the notes out of the way into a drawer (see section 2.8 Drawers). Customize the variable org-log-into-drawer to get this behavior--the recommended drawer for this is called LOGBOOK. You can also overrule the setting of this variable for a subtree by setting a LOG_INTO_DRAWER property.

Since it is normally too much to record a note for every state, Org-mode expects configuration on a per-keyword basis for this. This is achieved by adding special markers ‘!’ (for a timestamp) and ‘@’ (for a note) in parentheses after each keyword. For example, with the setting

(setq org-todo-keywords
  '((sequence "TODO(t)" "WAIT(w@/!)" "|" "DONE(d!)" 

you not only define global TODO keywords and fast access keys, but also request that a time is recorded when the entry is set to DONE,(42) and that a note is recorded when switching to WAIT or CANCELED. The setting for WAIT is even more special: the ‘!’ after the slash means that in addition to the note taken when entering the state, a timestamp should be recorded when leaving the WAIT state, if and only if the target state does not configure logging for entering it. So it has no effect when switching from WAIT to DONE, because DONE is configured to record a timestamp only. But when switching from WAIT back to TODO, the ‘/!’ in the WAIT setting now triggers a timestamp even though TODO has no logging configured.

You can use the exact same syntax for setting logging preferences local to a buffer:

#+TODO: TODO(t) WAIT(w@/!) | DONE(d!) CANCELED(c@)

In order to define logging settings that are local to a subtree or a single item, define a LOGGING property in this entry. Any non-empty LOGGING property resets all logging settings to nil. You may then turn on logging for this specific tree using STARTUP keywords like lognotedone or logrepeat, as well as adding state specific settings like TODO(!). For example

* TODO Log each state with only a time
* TODO Only log when switching to WAIT, and when repeating
  :LOGGING: WAIT(@) logrepeat
* TODO No logging at all
  :LOGGING: nil
ISBN 9781906966089The Org Mode 7 Reference ManualSee the print edition