]> git.donarmstrong.com Git - lilypond.git/blob - input/regression/apply-context.ly
Merge branch 'jneeman' of git+ssh://jneem@git.sv.gnu.org/srv/git/lilypond into jneeman
[lilypond.git] / input / regression / apply-context.ly
1
2 \version "2.10.0"
3
4
5 \header {
6
7 texidoc = "With @code{\\applyContext}, @code{\\properties} can be modified
8 procedurally. Applications include: checking bar numbers, smart
9 octavation.
10
11
12 This example prints a bar-number during processing on stdout.
13 "
14
15 }
16
17 \layout { ragged-right= ##t }
18
19
20 \relative c'' {
21   c1 c1
22
23   %% todo: should put something interesting in the .tex output.
24   
25   \applyContext
26   #(lambda (tr)
27     (format #t "\nWe were called in barnumber ~a.\n"
28      (ly:context-property tr 'currentBarNumber)))
29   c1 c1
30 }