]> git.donarmstrong.com Git - lilypond.git/blobdiff - input/regression/apply-context.ly
* lily/slur-quanting.cc (init_score_param): read scoring
[lilypond.git] / input / regression / apply-context.ly
index 2cf54b1b9915f21c8c2836b0ba3d3a1d902a192d..7b838a5f1db71974680c8a959463f954b6665bb3 100644 (file)
@@ -1,22 +1,30 @@
+
+\version "2.3.4"
+
+
 \header {
 
-texidoc = "with \\applycontext, \\properties can be modified
+texidoc = "With @code{\\applycontext}, @code{\\properties} can be modified
 procedurally. Applications include: checking bar numbers, smart
-octavation. "
+octavation.
+
+
+This example prints a bar-number during processing on stdout.
+"
 
 }
 
-\score { \notes \relative c'' {
+    \paper { raggedright= ##t }
+
+
+\score {  \relative c'' {
     c1 c1
 
     %% todo: should put something interesting in the .tex output.
     
-    \applycontext #(lambda (tr)
-                   (let* ((bn (ly:get-context-property tr 'currentBarNumber)))
-                    (if (= bn  3)
-                     #t
-                     (format #t "We were called in  ~a" bn))
-                ))
-
+    \applycontext
+       #(lambda (tr)
+        (format #t "\nWe were called in barnumber ~a.\n"
+         (ly:context-property tr 'currentBarNumber)))
     c1 c1
 }}