The \once prefix

\override, \revert, \set, and \unset commands may be prefixed with \once. This causes such a command to be effective only during the current musical moment before the property reverts back to its previous value (this can be different from the default if another \override is still in effect). Using the same example, we can change the color of a single note like this:

\relative {
  c'4 d
  \override NoteHead.color = "red"
  e4 f |
  \once \override NoteHead.color = "green"
  g4 a
  \once \revert NoteHead.color
  b c |
  \revert NoteHead.color
  f2 c |

[image of music]

The \once prefix may also be used in front of many predefined commands to limit their effect to one musical moment:

\relative {
  c'4( d)
  \once \slurDashed
  e4( f) |
  g4( a)
  \once \hideNotes
  b( c) |

[image of music]

LilyPond — Learning Manual v2.25.8 (development-branch).