summaryrefslogtreecommitdiff
path: root/2d
diff options
context:
space:
mode:
authorDavid Thompson <dthompson@member.fsf.org>2013-09-15 20:26:29 -0400
committerDavid Thompson <dthompson@member.fsf.org>2013-09-15 20:26:29 -0400
commit6ff97f3185245a9eea3fe8726f7ceef068069997 (patch)
tree1c286eccc403b75c85019ab6e6e3daced2b18904 /2d
parent1b929f254856edc4e6c8c10c271827f92b0ebc83 (diff)
Add agenda-schedule-interval procedure.
Diffstat (limited to '2d')
-rw-r--r--2d/agenda.scm15
1 files changed, 14 insertions, 1 deletions
diff --git a/2d/agenda.scm b/2d/agenda.scm
index ca23dac..6e9f61d 100644
--- a/2d/agenda.scm
+++ b/2d/agenda.scm
@@ -28,6 +28,7 @@
#:export (make-agenda
with-agenda
agenda-schedule
+ agenda-schedule-interval
update-agenda
clear-agenda))
@@ -170,9 +171,21 @@ in the list"
(set-agenda-segments! agenda '()))
(define* (agenda-schedule thunk #:optional (delay 1))
- "Schedules thunk in the current agenda."
+ "Schedules THUNK in the current agenda to run after DELAY
+updates (1 by default)."
(%agenda-schedule *current-agenda* thunk delay))
+(define* (agenda-schedule-interval thunk #:optional (interval 1) (delay 1))
+ "Schedules THUNK in the current agenda to run after DELAY updates
+and run every INTERVAL updates thereafter. Both DELAY and INTERVAL
+default to 1. Simply pass THUNK and nothing else to schedule THUNK to
+be run upon every update."
+ (%agenda-schedule *current-agenda*
+ (lambda ()
+ (thunk)
+ (agenda-schedule-interval thunk interval interval))
+ delay))
+
(define (update-agenda)
"Updates the current agenda."
(%update-agenda *current-agenda*))