Fix parenthesize to work with single notes, rests and whole chords
By default, Lilypond's \parenthesize function (to put parentheses around notes,
articulations, etc.) only works on notes if they are written inside a chord.
In particular, \parenthesize c4 will not work, only <\parenthesize c>4 will.
Similarly, trying to parenthesize a rest will fail. The reason is that
internally, Lilypond understands c4 as <c>4, so the first example is
internally the same as \parenthesize <c>4. The apparent solution is to make
\parenthesize apply to all elements inside a chord instead of the chord
itself (which the current implementation does).
In fact, one can simply redefine the \parenthesize function, which sets
the parenthesize property of a music expression to ##t, so that if applied
to a chord, it will set this property for all note and rest children of a
chord. This immediately solves the problem of parenthesizing rests, as well
as allowing the parenthesizing of all notes inside a chord at once. All
other uses of \parenthesize continue working as usual. So, using the
redefinition of \parenthesize from the snippet, finally the following
commands work as expected:
\parenthesize c4-. \parenthesize r4 \parenthesize <c e g>4->