From 2e7b9a36b369938bcc5a488449b9759a1f700024 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Tue, 12 Jan 2016 08:36:37 -0500 Subject: signal: Run newly added hooks immediately. * sly/signal.scm (add-signal-hook!): Apply 'proc' immediately. --- sly/signal.scm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sly/signal.scm b/sly/signal.scm index a35f042..5bd9a29 100644 --- a/sly/signal.scm +++ b/sly/signal.scm @@ -116,8 +116,12 @@ procedure PROC, and a list of INPUTS." (define (add-signal-hook! signal proc) "Add PROC, a procedure that accepts a single argument, to the hook associated with SIGNAL. When SIGNAL receives a new value, PROC will -be applied with that value." - (add-hook! (signal-hook (signal-unbox signal)) proc)) +be applied with that value. PROC will automatically be called once +after registering it to run the hook with the current value of +SIGNAL." + (add-hook! (signal-hook (signal-unbox signal)) proc) + ;; Run the initial hook. + (proc (signal-ref signal))) (define (remove-signal-hook! signal proc) "Remove the procedure PROC from the hook associated with SIGNAL." -- cgit v1.2.3