Paul Morris <p...@paulwmorris.com> writes: > given custom staff context, but do nothing when it is called from a > standard staff context. Then I could put the music, with calls to the > function, into a variable, and use that variable in both custom and > standard staves. When called from the custom staff the function would > make changes, but when called from the standard staff it would do > nothing. > > I've tried to do this by using ly:context-name: > > Function: ly:context-name context > Return the name of context, i.e., for \context Voice = "one" … return the > symbol Voice. > > and maybe getting the "context" argument by using ly:translator-context: > > Function: ly:translator-context trans > Return the context of the translator object trans. > > http://www.lilypond.org/doc/v2.16/Documentation/internals/scheme-functions > > But to do that I need the "translator object" (which seems to be an > engraver?), and I'm not sure how to do that. Maybe there is a way to > get to it from the grob?
A grob can be announced in multiple contexts, so no. > displaceHeads = > #(define-music-function (parser location offsets) (list?) > " > Moves the NoteHeads, using (shift offsets) > " > #{ > \once \override NoteColumn #'before-line-breaking = #(shift offsets) > #}) At the time this is called, there are no live contexts. You might want to try fiddling with the context grob properties (huh, do we even have functions for that?) directly in a function called via \applyContext. -- David Kastrup _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user