> > To do something like you want, you really would need access to context > properties.... >
Ok — good to know I haven't missed some simple solution. It seems like there ought to be some way of smuggling information out of an \applyContext. But I guess there's a variable scope issue that keeps you from doing it straightforwardly: k = "OOPS" text = #(define-music-function (parser location music) (ly:music?) #{ \applyContext #(lambda (context) (set! k (ly:context-property context 'tonic)) (display k) ) \transpose #(ly:make-pitch 0 0) #k #music #} ) \score { \new Staff { \key a \major \test { Fa So La fa so } } } In that code, the (display k) works fine, displaying #<Pitch a>. But then the \transpose #(ly:make-pitch 0 0) #k #music gets ahold of the global definition of #k rather than the local one and so you end up with a type error: expecting pitch, found "OOPS". So maybe the question is, does Lilypond Scheme have anything like global variables?
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user