Paul Morris <p...@paulwmorris.com> writes: >> On Oct 19, 2015, at 10:59 AM, David Kastrup <d...@gnu.org> wrote: >> >> Paul Morris <p...@paulwmorris.com> writes: >>> >>> That did the trick and now it works, thanks! >>> >>> \version “2.19.22” >>> >>> myfunc = >>> #(define-music-function () () >>> #{ >>> \context Staff >>> \applyContext >>> #(lambda (context) >>> ;; access context properties and pick a property setting based on >>> them... >>> (ly:context-pushpop-property context 'StaffSymbol 'color green)) >>> \stopStaff >>> \startStaff >>> #}) >> >> Frankly, anything wrong with >> >> \temporary \override Staff.StaffSymbol.color = #green >> >> here? > > That would work except I want to be able to access Staff context > properties and then, based on their values, decide what to set the > StaffSymbol property to. In this example, say color it either green > or blue. I just left these details out of my tiny example (as I tried > to indicate with the comment "access context properties and pick a > property setting based on them…”, which may not have been very clear).
Ok, that makes sense. One can override grob properties with a callback but they will be called (with the grob as argument) at the time the property is actually needed, and at that time the only context properties from the time of call will be the grob property defaults stored in the grob, in this case the StaffSymbol settings. And it does not sound like that would help you. So \applyContext indeed seems like the right call here. -- David Kastrup _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user