lilypond-user
[Top][All Lists]
Advanced

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

Re: \include problem in Scheme function


From: Urs Liska
Subject: Re: \include problem in Scheme function
Date: Thu, 09 May 2013 12:54:20 +0200

Am Donnerstag, den 09.05.2013, 11:38 +0200 schrieb David Kastrup:
> Urs Liska <address@hidden> writes:
> 
> > 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.
> 
> Minimal example?
> 

Minimal example (for that part) is already the solution (sometimes you
have to post a question in order to be able to answer it yourself :-)

compileSegment = 
#(define-void-function (parser location segment)
   (ly:music?)
   ; construct book
   (let ((book #{ \book { \score { \new Staff $segment } } #}))
         (ly:book-process book #{ \paper {} #} #{ \layout {} #} 
(ly:parser-output-name parser))
    ); close let
) % end function

music = { c d e d c \origBreak } % origBreak is defined in an include-file

\compileSegment \music

################################################

What I didn't achieve so far is how to \include library files.
It seems I can write an \include statement within \book before \score,
and it seems to find the file.
But it seems there are two problems with that:
a)
'music' is parsed before the \include is done within the function, so
\origBreak is still 'unknown'
b)
I get all sorts of messages about syntax errors in the included file, so
I have the impression such an \include from within a Scheme function is
something quite different from a regular \include in LilyPond mode.

################################################

Now what's still missing is the check whether the compiled file is a .ly
or a .ily file.
(ly:parser-output-name parser) gives me everything that's _not_
interesting in this case. Is it possible to get the file extension of
the file currently compiled?

Any further enlightenment highly appreciated!

Urs




reply via email to

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