diff options
-rw-r--r-- | starling/minibuffer.scm | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/starling/minibuffer.scm b/starling/minibuffer.scm index 2515604..9488530 100644 --- a/starling/minibuffer.scm +++ b/starling/minibuffer.scm @@ -35,6 +35,7 @@ #:use-module (starling scene) #:export (<minibuffer> add-minibuffer-command + define-minibuffer-command open-minibuffer)) (define-class <minibuffer> (<scene-2d>) @@ -49,6 +50,9 @@ (define-method (add-minibuffer-command name thunk) (hash-set! (minibuffer-commands) name thunk)) +(define-syntax-rule (define-minibuffer-command name body ...) + (add-minibuffer-command (symbol->string 'name) (lambda () body ...))) + (define-method (open-minibuffer minibuffer) (set! (overlay-scene minibuffer) (current-scene (scene-mux minibuffer))) (push-scene (scene-mux minibuffer) minibuffer)) |