Hi David,
If you don't want to call upon undocumented internals of LilyPond (the (@@ (lily) ...) bit), you can just use
[with-output-to-string] Wow, thanks! I hadn't encountered this possibility yet. Also thanks for pointing out the possibility of in-place modification. Lukas