X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=ly%2Fcontext-mods-init.ly;h=a4064f4b327a4df15bef871dff36d801efe50d2d;hb=a6a51abfd0195a3cf7d6ea095cf69808852f21ce;hp=6d942d7e93e3d39f54edb6081b5369509c7b96de;hpb=4bb29573149a0ffa1f881c5e38a0fe68e9e76b67;p=lilypond.git diff --git a/ly/context-mods-init.ly b/ly/context-mods-init.ly index 6d942d7e93..a4064f4b32 100644 --- a/ly/context-mods-init.ly +++ b/ly/context-mods-init.ly @@ -1,6 +1,6 @@ %%%% This file is part of LilyPond, the GNU music typesetter. %%%% -%%%% Copyright (C) 2011 Han-Wen Nienhuys +%%%% Copyright (C) 2011--2015 Han-Wen Nienhuys %%%% Jan Nieuwenhuizen %%%% %%%% LilyPond is free software: you can redistribute it and/or modify @@ -16,18 +16,41 @@ %%%% You should have received a copy of the GNU General Public License %%%% along with LilyPond. If not, see . -\version "2.15.6" +\version "2.17.6" RemoveEmptyStaves = \with { - \remove "Axis_group_engraver" - % If RemoveEmptyStaves is called twice, two - % Hara_kiri_engravers would be added, which leads to a - % warning. - % This code makes sure that no previous Hara_kiri_engraver - % is left before adding a new one. - \remove "Hara_kiri_engraver" - \consists "Hara_kiri_engraver" - \override VerticalAxisGroup #'remove-empty = ##t + \override VerticalAxisGroup.remove-empty = ##t \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")))))