Forcing visibility of systems with multi-bar rests when using \RemoveEmptyStaffContext

In an orchestral score, you may find it useful to hide multi-bar rests using \RemoveEmptyStaffContext to produce a Frenched score, but this can prove problematic when you want to make such bars visible.

For example, imagine you are using a PianoStaff for a harp part. When there is music in one stave, you will want both staves to be visible. Of course, adding hidden notes to the invisible staff will make the stave visible, but this is a rather ugly kludge.

A more elegant solution is to use the property keepAliveInterfaces. This determines which items of musical output are interesting enough to keep a bar visible when remove-empty is set. By default, it looks like this:

keepAliveInterfaces = #'( rhythmic-grob-interface lyric-interface stanza-number-interface percent-repeat-interface)

If you insert multi-measure-rest-interface into this list, multi-bar rests count as interesting items. You can then create macros to switch this behaviour on and off as required:

showMultiRests = { \set Staff.keepAliveInterfaces = #'( rhythmic-grob-interface multi-measure-rest-interface lyric-interface stanza-number-interface percent-repeat-interface) }

hideMultiRests = \unset Staff.keepAliveInterfaces

For this to work successfully, you must place these macros carefully, otherwise they tend to interfere with the visibility of other hidden staves.