+%% We need to save the variables of the current module along with
+%% their values: functions defined in the module might refer to the
+%% variables
+
+#(if lilypond-declarations
+ (if (pair? lilypond-declarations)
+ (begin
+ (for-each
+ (lambda (p)
+ (let ((var (cadr p))
+ (val (cddr p)))
+ (variable-set! var
+ (if (ly:output-def? val)
+ (ly:output-def-clone val)
+ val))
+ (module-add! (current-module) (car p) var)))
+ lilypond-declarations)
+ (note-names-language parser default-language))
+ (module-for-each
+ (lambda (s v)
+ (let ((val (variable-ref v)))
+ (if (not (ly:lily-parser? val))
+ (set! lilypond-declarations
+ (cons
+ (cons*
+ s v
+ (if (ly:output-def? val)
+ (ly:output-def-clone val)
+ val))
+ lilypond-declarations)))))
+ (current-module))))