Browse code
feat(restarts): retry-once macro that re-runs the provided forms
Edward authored on 20/12/2021 22:03:18
Showing 2 changed files
Showing 2 changed files
... | ... |
@@ -326,3 +326,13 @@ |
326 | 326 |
`(eval-when (:load-toplevel :compile-toplevel :execute) |
327 | 327 |
(defun ,name ,args |
328 | 328 |
,@body))) |
329 |
+ |
|
330 |
+(defmacro retry-once (&body body) |
|
331 |
+ (alexandria:with-gensyms (flag) |
|
332 |
+ `(let ((,flag t)) |
|
333 |
+ (tagbody |
|
334 |
+ start |
|
335 |
+ ,@body |
|
336 |
+ (when ,flag |
|
337 |
+ (setf ,flag nil) |
|
338 |
+ (go start)))))) |