diff options
author | Ludovic Courtès | 2010-03-08 00:29:21 +0100 |
---|---|---|
committer | Ludovic Courtès | 2010-03-08 00:29:21 +0100 |
commit | c98a0c6da29a028282f0decac3056f9df0e40c1c (patch) | |
tree | 04801015ffdb4d32f5c3642d4b5297b86ef6018d /src/guile | |
parent | 86de6d9453a9d747bddadd20fce67e58c4dbe8c7 (diff) | |
download | skribilo-c98a0c6da29a028282f0decac3056f9df0e40c1c.tar.gz skribilo-c98a0c6da29a028282f0decac3056f9df0e40c1c.tar.lz skribilo-c98a0c6da29a028282f0decac3056f9df0e40c1c.zip |
Don't set module names when using Guile 2.x.
* src/guile/skribilo/module.scm (maybe-set-module-name!): New procedure.
Diffstat (limited to 'src/guile')
-rw-r--r-- | src/guile/skribilo/module.scm | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/guile/skribilo/module.scm b/src/guile/skribilo/module.scm index 1e898a0..b6d5f07 100644 --- a/src/guile/skribilo/module.scm +++ b/src/guile/skribilo/module.scm @@ -96,6 +96,22 @@ ;;; Run-time document modules. ;;; +(define maybe-set-module-name! + ;; In Guile 2.x, `psyntax' expect module names to be actually bound using + ;; `nested-define!' (see the definition of `module-name' in `boot-9.scm'). + ;; Thus, if we want to change a custom module name, we should also do the + ;; `nested-define!' magic. Failing to do that results in errors like: + ;; + ;; <unnamed port>: In expression (use-modules (foo)): + ;; <unnamed port>: Wrong number of arguments to #<program 8868a0 (y)> + ;; + ;; (Observed on Guile 1.9.5.) + ;; + ;; Consequently, on Guile 2.x, we just let Guile choose a module name and + ;; do the right thing. + (cond-expand ((not guile-2) set-module-name!) + (else (lambda (m n) #t)))) + (define (make-skribe-user-module) "Return a new module that imports all the necessary bindings required for execution of legacy Skribe code/documents." @@ -105,7 +121,7 @@ execution of legacy Skribe code/documents." (car name+bindings) (cdr name+bindings))) %skribe-user-autoloads))) - (set-module-name! the-module '(skribe-user)) + (maybe-set-module-name! the-module '(skribe-user)) (module-use-interfaces! the-module (cons the-scm-module (append (map resolve-interface @@ -117,7 +133,7 @@ execution of legacy Skribe code/documents." "Return a new module that imports all the necessary bindings required for Skribilo documents." (let* ((the-module (make-module))) - (set-module-name! the-module '(skribilo-user)) + (maybe-set-module-name! the-module '(skribilo-user)) (module-use-interfaces! the-module (cons the-scm-module (map resolve-interface |