Hi Harm, thanks for that suggestion. Unfortunately it doesn't quite do what I need, and I don't really understand it. But fortunately it gives quite a good clue how to ask more concretely.
It seems that functions/properties like ly:context-id ly:context-name provide information on the current context we're in. a) Is it possible to gather a list of all (Staff) contexts that are currently present? b) Is it possible to determine whether a given context is within a StaffGroup (or similar)? With this information I hope it would be possible to identify the previous or next staff within a system in order to be able to "\change" to that Staff context. Best Urs On Tue, 2 Apr 2013 01:20:00 +0200 Thomas Morley <thomasmorle...@googlemail.com> wrote: > \verson "2.17.15" > > %%%% Helper functions, which simply print out the observed Music > %%%% in a nice format: > #(define (format-ctx engraver event) > (let* ((context (ly:translator-context engraver)) > (ctx (ly:context-id context)) > (ctx-name (ly:context-name context)) > ;(mus (ly:event-property event 'music)) > ) > (ly:message "We are in \"~a\" with name \"~a\"\n\n" ctx-name ctx) > ) > ) > > %%%% The actual engraver definition: We just install a listener. > > ctxInfo = > #(list > (cons 'listeners > (list > (cons 'note-event format-ctx)))) > > \layout { > \context { > % I add this to the score, so all voices are caught. You can also only add > % the engraver to selected voices to get the statistics split down. > \Staff > \consists #ctxInfo > } > } > > \new ChoirStaff << > \new Staff = "One" \with { instrumentName = "ctx 1" } > { \clef "treble_8" s1 * 6 } > > \new Staff = "Two" \with { instrumentName = "ctx 2" } > { \clef treble s1 * 6 } > > \new Staff = "Three" \with { instrumentName = "ctx 3" } > { \clef alto s1 * 6 } > > \new Staff = "Four" \with { instrumentName = "ctx 4" } > \relative f { > \clef bass c4 d e f > \change Staff = "Three" g' a b c > \change Staff = "Two" g a b c > \change Staff = "One" g, a b c > \change Staff = "Three" g a b c > \change Staff = "Four" g a b c > } > >> _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user