1\version "2.19.21"
2
3\header  {
4texidoc = "Context modifications can be stored into a variable as a
5\with object. They can be later inserted directly into a context definition."
6}
7
8% Some sample modifications to be inserted into a \with block later on
9ctxmod = \with {
10  \remove "Time_signature_engraver"
11  \consists "Ambitus_engraver"
12  \override StaffSymbol.line-count = 4
13}
14
15music = \relative { \key fis \minor c''1 d e }
16
17\score { <<
18    \new Staff { \music}
19  >>
20  \layout {
21    \context { \Staff
22      \ctxmod
23      \override NoteHead.style = #'petrucci
24    }
25  }
26}
27
28
29\score { <<
30    \new Staff { \music}
31  >>
32  \layout {
33    \context { \Staff
34      \override StaffSymbol.line-count = 3
35      \override NoteHead.style = #'petrucci
36    }
37    % Should override the above definitions, but not reset others
38    \context { \Staff
39      \ctxmod
40    }
41  }
42}
43
44