Next: , Up: Contexts for programmers



C.3.1 Context evaluation

Contexts can be modified during interpretation with Scheme code. The syntax for this is

       \applycontext function

function should be a Scheme function taking a single argument, being the context to apply it to. The following code will print the current bar number on the standard output during the compile:

         \applycontext
           #(lambda (x)
              (format #t "\nWe were called in barnumber ~a.\n"
               (ly:context-property x 'currentBarNumber)))

Read comments on this page, or add one.

This page is for LilyPond-2.2.6 (stable-branch).

Report errors to <bug-lilypond@gnu.org>.