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 13:44:24 +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,
Any reason you don't just do #{ \include #file #} here?

yes there is:
--snip--
\version "2.15.21"

#(define-public includeLocal (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))
             #{ \include $file #}
             (make-music 'SequentialMusic 'void #t)))))

\includeLocal "test.ily"
--snip--
this places the include in some context, generated by #{ #}.
So if I have:
--snip-- ("test.ily")
\version "2.15.21"

mus = \relative c' {
  c4 e g c
}

{ \mus }
--snip--
it will fail, because I try to assign "mus" here in a contained context.

Cheers,
Jan-Peter




reply via email to

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