diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-04-25 14:39:45 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-04-25 14:39:45 +0200 |
commit | c0790ef35e1e0f0eb43f5f939cbe9922eb80c938 (patch) | |
tree | 217c7c0abdef75a45dfc01f2caa4ff91a6e1803f /module | |
parent | util now sets keyword style. (diff) | |
download | calp-c0790ef35e1e0f0eb43f5f939cbe9922eb80c938.tar.gz calp-c0790ef35e1e0f0eb43f5f939cbe9922eb80c938.tar.xz |
define-config now expands correctly.
Diffstat (limited to '')
-rw-r--r-- | module/util/config.scm | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/module/util/config.scm b/module/util/config.scm index 33da9980..3ac78e31 100644 --- a/module/util/config.scm +++ b/module/util/config.scm @@ -29,11 +29,11 @@ ;; similar to emacs defcustom ;; TODO possibly make @var{documentation} and @var{valid-value?} optional. (define-macro (define-config name default-value documentation valid-value?) - `(let ((make-config (@@ (util config) make-config)) - (config-values (@@ (util config) config-values)) - ;; (config? (@@ (util config) config?)) - (get-value (@@ (util config) get-value))) - (cond [(hashq-ref config-values (quote ,name)) + (let ((make-config '(@@ (util config) make-config)) + (config-values '(@@ (util config) config-values)) + (config? '(@@ (util config) config?)) + (get-value '(@@ (util config) get-value))) + `(cond [(hashq-ref ,config-values (quote ,name)) => (lambda (value) ;; When reloading a module an already defined configuration item ;; might be loaded again, just anwrap it and pretend that didn't @@ -49,14 +49,14 @@ ,valid-value? ,documentation) (list value))) - (hashq-set! config-values (quote ,name) - (make-config value ,documentation - ,valid-value? (current-module))))] + (hashq-set! ,config-values (quote ,name) + (,make-config value ,documentation + ,valid-value? (current-module))))] ;; value not set in advance [else - (hashq-set! config-values (quote ,name) - (make-config ,default-value ,documentation - ,valid-value? (current-module)))]))) + (hashq-set! ,config-values (quote ,name) + (,make-config ,default-value ,documentation + ,valid-value? (current-module)))]))) (export define-config) |