1\version "2.19.80"
2
3\header {
4  texidoc = "@code{\\denies} @var{context} in a @code{\\with} block cancels
5a prior @code{\\defaultchild} @var{context}.  CREATED should appear in the
6left margin."
7}
8
9\layout {
10  \context {
11    \Score
12    \accepts "AdHocStaff"
13  }
14
15  \context {
16    \Staff
17    \name "AdHocStaff"
18    \alias Staff
19    instrumentName = "CREATED"
20  }
21
22  \context {
23    \Staff
24    instrumentName = "DENIED"
25  }
26
27}
28
29\new Score \with {
30  %% If this cancelled \accepts without cancelling \defaultchild,
31  %% Score would still accept a Staff because default children are
32  %% implicitly accepted with the highest priority.
33  \denies "Staff"
34} <<
35  %% This builds a path of accepted contexts from Score to Voice.
36  %% Which context it chooses tells whether \denies did its job.
37  \context Voice s1
38>>
39