Coloring grobs and notational elements using a sophisticated music function

Some scholarly or ‘urtext’ editions use grey color to indicate editorial additions. I find this very elegant, so I wrote a function to easily use this in a score. Instead of writing \override [Context.]Grob.color = #grey …some music… \revert [Context.]Grob.color, it allows to simply write \ed [Context.]Grob [#color] { …some music } (or omit the {}, if it’s only for one note or rest). Note that in v2.18 there is a shortcoming here: a single rest or multi measure rest will need to be enclosed in braces. This doesn’t hold anymore with v2.19, at the least since 2.19.8.

The color may be optionally specified to use another than the default color (defined as editorsColor).

In order to conveniently address more complex notational elements (and to save typing with long grob names), the function also permits using shortcuts such as \ed Note { …some music } . Some are predefined, but others may be easily added.