bug-lilypond
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Custom contexts: \accepts behaves weirdly for grouping contexts


From: Janek Warchoł
Subject: Custom contexts: \accepts behaves weirdly for grouping contexts
Date: Thu, 31 Jul 2014 19:35:58 +0200

Hi,

i have noticed something strange wrt/ \accepts behaviour.

Let's start with a minimal example: i define new Staff-like context
Foo that has red noteheads:

\layout {
  \context {
    \Staff
    \name "Foo"
    \override NoteHead.color = #red
  }
}

\new Foo { c'1 }

But this doesn't work (noteheads are black, which means that instead
of a Foo a Staff is created), because no context accepts Foo.  So i do

\layout {
  \context {
    \Score
    \accepts "Foo"
  }
  \context {
    \Staff
    \name "Foo"
    \override NoteHead.color = #red
  }
}

\new Foo { c'1 }

This works, but i cannot put several Foos in a ChoirStaff (or a
StaffGroup, etc.), i.e.

\new ChoirStaff <<
  \new Foo { c'1 }
  \new Foo { c' }
>>

will not get the grouping bracket.  Fine, i change the code to

\layout {
  \context {
    \ChoirStaff
    \accepts "Foo"
  }
  \context {
    \Staff
    \name "Foo"
    \override NoteHead.color = #red
  }
}

\new ChoirStaff <<
  \new Foo { c'1 }
  \new Foo { c' }
>>

Now here's where the strangeness appears.  With the above definition,
only \ChoirStaff should accept Foo, shouldn't it?  But if i write

\new StaffGroup <<
  \new Foo { c'1 }
  \new Foo { c' }
>>

it will also work, i.e. i'll get a StaffGroup of Foos.  Moreover,

\new Foo { c'1 }

(i.e. no grouping at all) also works.
Is this a bug, or a feature i don't understand?

best,
Janek



reply via email to

[Prev in Thread] Current Thread [Next in Thread]