lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "include" music-function


From: Jan-Peter Voigt
Subject: Re: "include" music-function
Date: Thu, 05 Jan 2012 15:44:18 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.24) Gecko/20111108 Lightning/1.0b2 Thunderbird/3.1.16

Hello David,

Am 05.01.2012 13:50, schrieb David Kastrup:

Ah yes.  ly:parse-file does not help either?

yes it does, thanks ... but ...

--snip--
#(define-public includeLoc (define-music-function (parser location file)(string?)
    (let ((outname (format "~A.ly" (ly:parser-output-name parser)))
          (locname (car (ly:input-file-line-char-column location))))
(if (or (string=? outname locname)(string-suffix? outname locname))
             (ly:parse-file file))
         (make-music 'SequentialMusic 'void #t))))
--snip--

I nowadays store the music in a scheme structure saved as a singleton in a self-made module. If the included file refers to this singleton, the music will appear ... great!

Before this, I created variables
--snip--
music = \relative c' { c4 e g c }
\includeLocal "test-music.ly"
--snip--
and used a file
--snip-- (test-music.ly)
{ \music }
--snip--

This does not work ... the var "music" is not known in the file included with ly:parse-file. There has been a function ly:parser-parse-file in 2.12 - and if my memory doesn't trick me, there has been discussion on devel why and how to remove it.
This might or might not have been useful in this context.
So a question remains: How could I carry defined variables between inside-outside ly:parse-file ?

Cheers,
Jan-Peter




reply via email to

[Prev in Thread] Current Thread [Next in Thread]