Is there a hook that runs after a TODO state change triggers a repeat? I have a few weekly tasks that I've set up as habits. These refer to scheduled lessons. I have the idea that it would be pretty cool to include in the habit entry a link pointing to the next lesson. When I mark the habit DONE, it processes the repeat (updates the habit's scheduled time and switches the state back to TODO). That would be the point to find the next lesson for that group of students and update the link text. The most reliable way would be to search for the earliest lesson whose scheduled time is later than the updated timestamp for the habit.
I did some searching but didn't find a hook that appeared obviously to be suitable. I suppose a TODO state-change hook might have worked, provided that the repeating timestamp will be processed before the state change. Unfortunately, it appears that it goes in the opposite order: in org-auto-repeat-maybe, (org-todo to-state) occurs at line 13152, well before processing the new timestamp (13172-13209). So I guess not that one. Any ideas? Thanks, hjh