Hi,

I want to implement a way to compile a score from a given music
expression. THe idea is to have a huge score edited in small chunks and
being able to only compile the tiny chunk one works on currently.

First I tried several things to compile a book within the function but
didn't succeed.
Then I realized that it basically could be very simple:

% in an included file
compileSegment =
#(define-music-function (parser location segment)
   (ly:music?)
   segment
   )

music = { c d c }

\compileSegment \music

which returns 'music' as a top-level expression that is compiled to a
score. I would still add a condition that only returns the segment when
the to-be-compiled file is a .ily file and not a .ly file. This way
'music' would only be printed when that segment file is compiled
standalone and not when it is 'used' by another .ly file. 

But this way the \include operations of the original score aren't
applied of course, so I'll get errors about "unknown escaped strings"
when they are used within 'music'.

First I thought to add

#{ \include "initEdition.ily" #}

but this (naturally) doesn't affect the returned 'segment' music.

So the question(s) is/are:
Can I change the above function to apply includes also, i.e. first
return the result of anything in the include files and then the
'segment'?

Or is there a better approach to my problem, i.e. compile a given music
expression to a score, including some \include files (that can be
hardcoded in the function) and only if the compiled file is an .ily, not
a .ly file?

Thanks for any help
Urs


_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to