Paul Morris <p...@paulwmorris.com> writes: > % These work as expected > { > c' > \stopStaff > \startStaff > \override Staff.StaffSymbol.color = #red > c' > \override Staff.StaffSymbol.color = #green > \stopStaff > \startStaff > c’ > } > > { > \applyContext > #(lambda (context) > ;; access context properties pick a property setting based on them... > (ly:context-pushpop-property context 'StaffSymbol 'color blue)) > c’ > } > > % But so far these don’t... > > myfunc = > #(define-music-function () () > (define mycolor red) > #{ > \applyContext > #(lambda (context) > ;; access context properties and pick a property setting based on > them... > (set! mycolor green)) > \override Staff.StaffSymbol.color = #mycolor > #}) > > { > c’ > % the order of these commands does not seem to affect things > \stopStaff \startStaff > \applyContext > #(lambda (context) > ;; access context properties and pick a property setting based on them... > (ly:context-pushpop-property context 'StaffSymbol 'color blue)) > c' > \myfunc > \stopStaff \startStaff > c' > }
I think your main problem is that you are using \applyContext here at Voice level where it does not really do anything worthwhile. Try \context Staff \applyContext ... Though frankly I have no idea what \myFunc is trying to do. You are keeping state in a global variable which is not going to work when using \myFunc in several contexts in parallel. -- David Kastrup _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user