%% Generated by lilypond-book.py
%% Options: [alt=[image of music],printfilename,indent=0\mm,texidoc,line-width=160\mm]
\include "lilypond-book-preamble.ly"







% ****************************************************************
% Start cut-&-pastable-section 
% ****************************************************************

\paper {
  #(define dump-extents #t)
  
  indent = 0\mm
  line-width = 160\mm
  force-assignment = #""
  line-width = #(- line-width (* mm  3.000000))
}

\layout {
  
}



% ****************************************************************
% ly snippet:
% ****************************************************************
\sourcefilename "apply-context.ly"
\sourcefileline 0

\version "2.10.0"


\header {

texidoc = "With @code{\\applyContext}, @code{\\properties} can be modified
procedurally. Applications include: checking bar numbers, smart
octavation.


This example prints a bar-number during processing on stdout.
"

}

\layout { ragged-right= ##t }


\relative c'' {
  c1 c1

  %% todo: should put something interesting in the .tex output.
  
  \applyContext
  #(lambda (tr)
    (ly:progress "\nWe were called in bar number ~a.\n"
     (ly:context-property tr 'currentBarNumber)))
  c1 c1
}



% ****************************************************************
% end ly snippet
% ****************************************************************

