From: David Kastrup Date: Tue, 2 Apr 2013 13:22:13 +0000 (+0200) Subject: Issue 3291: Carry any exports from session initialization over to subsequent sessions X-Git-Tag: release/2.17.16-1~11 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=6cb2c5ec23dea45f3cba3a03dc0d9128b630742b;p=lilypond.git Issue 3291: Carry any exports from session initialization over to subsequent sessions When a .ly file in the session initialization loaded a module, this module's exports were only available in the first session on the command line. This patch causes any modules available after first session initialization to be available in subsequent sessions. --- diff --git a/scm/lily.scm b/scm/lily.scm index c1f8f1fe34..cd7b92964b 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -78,6 +78,8 @@ session has started." (lambda (p) (variable-set! (cadr p) (cddr p))) (ly:get-undead lilypond-declarations)))) +(define lilypond-interfaces #f) + (define-public (session-initialize thunk) "Initialize this session. The first session in a LilyPond run is initialized by calling @var{thunk}, then recording the values of all @@ -96,6 +98,7 @@ variables to their value after the initial call of @var{thunk}." (if (ly:undead? lilypond-declarations) (begin + (module-use-interfaces! (current-module) (reverse lilypond-interfaces)) (for-each (lambda (p) (let ((var (cadr p)) @@ -106,6 +109,9 @@ variables to their value after the initial call of @var{thunk}." (ly:get-undead lilypond-declarations))) (begin (thunk) + (set! lilypond-interfaces + (filter (lambda (m) (eq? 'interface (module-kind m))) + (module-uses (current-module)))) (let ((decl (map! (lambda (v) (cons* #f v (variable-ref v))) lilypond-declarations)))