]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 3291: Carry any exports from session initialization over to subsequent sessions
authorDavid Kastrup <dak@gnu.org>
Tue, 2 Apr 2013 13:22:13 +0000 (15:22 +0200)
committerDavid Kastrup <dak@gnu.org>
Tue, 9 Apr 2013 07:27:35 +0000 (09:27 +0200)
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.

scm/lily.scm

index c1f8f1fe3453362e9af71b0f6f47c83788a5dfa2..cd7b92964bdcfa21ea590ca5349c092fb94c87ca 100644 (file)
@@ -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)))