35.5 \temporary and \undo

\temporary modifies an override, like \once does. If you apply an \override, the old value is usually lost and can no longer be restored. \once works differently in that it reestablishes the previous value. If the effect of an override should last for more than a single timestep but the previous behavior should be restored afterwards, you can pair \temporary \override with \revert on the same property, with music requiring the override to be in effect in the middle.

\undo is a command that is most practical in combination with overrides packaged in definitions. If you apply \undo to such a property-changing definition, this will create the kind of command reverting the original command. So you can, for example, bracket a passage without visible Stem grobs as

\temporary \omit Stem
...
\undo \omit Stem

See Removing the stencil for an explanation of the \omit command.


LilyPond Notation Reference v2.27.5 (development-branch).