X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=ly%2Fcontext-mods-init.ly;h=a4064f4b327a4df15bef871dff36d801efe50d2d;hb=97a0169312a260933246ab224e4f8b0969871dd5;hp=e8b96025773683aab20fbf3e2d4f42b914105e5b;hpb=c054eb280fd9953596eb164f67b0f9d5555c5a32;p=lilypond.git diff --git a/ly/context-mods-init.ly b/ly/context-mods-init.ly index e8b9602577..a4064f4b32 100644 --- a/ly/context-mods-init.ly +++ b/ly/context-mods-init.ly @@ -23,3 +23,34 @@ RemoveEmptyStaves = \with { \description "Remove staves which are considered to be empty according to the list of interfaces set by @code{keepAliveInterfaces}." } + +RemoveAllEmptyStaves = \with { + \override VerticalAxisGroup.remove-empty = ##t + \override VerticalAxisGroup.remove-first = ##t + \description "Remove staves which are considered to be empty according +to the list of interfaces set by @code{keepAliveInterfaces}, including those +in the first system." +} + +inherit-acceptability = +#(define-void-function (to from) + (symbol? symbol?) + (_i "When used in an output definition, will modify all context +definitions such that context @var{to} is accepted as a child by all +contexts that also accept @var{from}.") + (let* ((module (current-module)) + (cmod (ly:make-context-mod))) + (ly:add-context-mod cmod (list 'accepts to)) + (if (output-module? module) + (module-map + (lambda (_sym var) + (if (variable-bound? var) + (let ((cdef (variable-ref var))) + (if (ly:context-def? cdef) + (let ((accepts (ly:context-def-lookup cdef 'accepts))) + (if (and (memq from accepts) + (not (memq to accepts))) + (variable-set! var + (ly:context-def-modify cdef cmod)))))))) + module) + (ly:parser-error (_ "Not in an output definition")))))