summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson@vistahigherlearning.com>2021-01-02 13:30:10 -0500
committerDavid Thompson <dthompson@vistahigherlearning.com>2021-01-02 13:30:10 -0500
commitd253d1db79eba8cc110f79af2d4a9aea6fa9be02 (patch)
tree956d8dddca34e7825a0bbc80a45d7a917d1872eb
parentcfc83946123f00ff8ffaec65d36887cd98d7ec77 (diff)
minibuffer: Add define-minibuffer-command macro.
-rw-r--r--starling/minibuffer.scm4
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))