Node:Context properties, Next:, Previous:Default contexts, Up:Interpretation context



Context properties

Contexts have properties. These properties are set from the .ly file using the following expression:

     \property contextname.propname = value
     

Sets the propname property of the context contextname to the specified Scheme expression value. Both propname and contextname are strings, which can often be written unquoted.

Properties that are set in one context are inherited by all of the contained contexts. This means that a property valid for the Voice context can be set in the Score context (for example) and thus take effect in all Voice contexts.

If you do not wish to specify the name of the context in the \property-expression itself, you can refer to the abstract context name, Current. The Current context is the latest used context. This will typically mean the Thread context, but you can force another context with the \property-command. Hence the expressions

     \property contextname.propname = value
     

and

     \context contextname
     \property Current.propname = value
     

do the same thing. The main use for this is in predefined variables. This construction allows the specification of a property-setting without restriction to a specific context.

Properties can be unset using the following statement.

     \property contextname.propname \unset
     

This removes the definition of propname in contextname. If propname was not defined in contextname (but was inherited from a higher context), then this has no effect.

Bugs

The syntax of \unset is asymmetric: \property \unset is not the inverse of \property \set.


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

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