Provide another indirection procedure with wrap-apply
[8sync.git] / eightsync / agenda.scm
index b26d93b6bdebe328981474e88a3d40f1dd901fef..1bfc0a3a941ac148d4214b014b8e1878d23c5e85 100644 (file)
@@ -61,7 +61,7 @@
             port-request-port
             port-request-read port-request-write port-request-except
 
-            run-it wrap run run-at run-delay
+            run-it wrap wrap-apply run run-at run-delay
 
             %port-request %run %run-at %run-delay
             8port-request 8run 8run-at 8run-delay
@@ -382,6 +382,12 @@ Will produce (0 . 0) instead of a negative number, if needed."
   (lambda ()
     body ...))
 
+(define-syntax-rule (wrap-apply body)
+  "Wrap possibly multi-value function in a procedure, applies all arguments"
+  (lambda args
+    (apply body args)))
+
+
 ;; @@: Do we really want `body ...' here?
 ;;   what about just `body'?
 (define-syntax-rule (run body ...)
@@ -561,7 +567,7 @@ return the wrong thing via (8sync) and trip themselves up."
                    (hash-keys (agenda-except-port-map agenda))
                    sec usec))
          (lambda (key . rest-args)
-           (match (pk 'rest-args rest-args)
+           (match rest-args
              ((_ _ _ (EINTR))
               '(() () ()))
              (_ (error "Unhandled error in select!" key rest-args))))))))