From mboxrd@z Thu Jan 1 00:00:00 1970 From: James Harkins Subject: Hook after handling repeating TODO? Date: Wed, 05 Nov 2014 11:08:34 +0800 Message-ID: <87oasmjqdp.wl-jamshark70@qq.com> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43426) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlqyB-0006qE-2k for emacs-orgmode@gnu.org; Tue, 04 Nov 2014 22:09:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xlqy5-0006QS-BI for emacs-orgmode@gnu.org; Tue, 04 Nov 2014 22:09:15 -0500 Received: from smtpproxy19.qq.com ([184.105.206.84]:34058) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xlqy2-0006L5-2q for emacs-orgmode@gnu.org; Tue, 04 Nov 2014 22:09:09 -0500 Received: from hjh-e431.qq.com (unknown [113.103.27.5]) by esmtp4.qq.com (ESMTP) with SMTP id 0 for ; Wed, 05 Nov 2014 11:08:35 +0800 (CST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: orgmode 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