lilypond-user
[Top][All Lists]
Advanced

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

When will a #(define ) be executed


From: Urs Liska
Subject: When will a #(define ) be executed
Date: Mon, 06 Oct 2014 18:46:51 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

Hi all,

I have a hard time understanding the integration between LilyPond and Scheme (still ...).


I'm trying to create a function that defines a function:


\version "2.19.16"


origBreak = {}


#(define keepOriginalBreaks

(define origBreak (define-music-function (parser location)()

#{ \break #})))

%\keepOriginalBreaks


\relative c' {

c c c c

\origBreak

\repeat unfold 128 c

}



As far as I understand it this snippet should do the following:

- create an empty command origBreak (so it can be used in the music _expression_)
- define a function keepOriginalBreaks that - when executed - redefines origBreak to produce a \break

In the form shown above the \origBreak command in the music _expression_ should then have no effect.
But actually it *does* issue a \break, and even if I comment out the initial definition of origBreak the file compiles - with the break after the first measure.

So obviously the "(define origBreak ...)" _expression_ gets evaluated even when \keepOriginalBreaks is not called.

Could someone explain to me what is happening here?

TIA
Urs


reply via email to

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