]> git.donarmstrong.com Git - lilypond.git/blob - ly/context-mods-init.ly
Doc: CG - Update information about LilyDev
[lilypond.git] / ly / context-mods-init.ly
1 %%%% This file is part of LilyPond, the GNU music typesetter.
2 %%%%
3 %%%% Copyright (C) 2011--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
4 %%%%                    Jan Nieuwenhuizen <janneke@gnu.org>
5 %%%%
6 %%%% LilyPond is free software: you can redistribute it and/or modify
7 %%%% it under the terms of the GNU General Public License as published by
8 %%%% the Free Software Foundation, either version 3 of the License, or
9 %%%% (at your option) any later version.
10 %%%%
11 %%%% LilyPond is distributed in the hope that it will be useful,
12 %%%% but WITHOUT ANY WARRANTY; without even the implied warranty of
13 %%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 %%%% GNU General Public License for more details.
15 %%%%
16 %%%% You should have received a copy of the GNU General Public License
17 %%%% along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
18
19 \version "2.17.6"
20
21 RemoveEmptyStaves = \with {
22   \override VerticalAxisGroup.remove-empty = ##t
23   \description "Remove staves which are considered to be empty according
24 to the list of interfaces set by @code{keepAliveInterfaces}."
25 }
26
27 inherit-acceptability =
28 #(define-void-function (to from)
29    (symbol? symbol?)
30    (_i "When used in an output definition, will modify all context
31 definitions such that context @var{to} is accepted as a child by all
32 contexts that also accept @var{from}.")
33    (let* ((module (current-module))
34           (cmod (ly:make-context-mod)))
35      (ly:add-context-mod cmod (list 'accepts to))
36      (if (output-module? module)
37          (module-map
38           (lambda (_sym var)
39             (if (variable-bound? var)
40                 (let ((cdef (variable-ref var)))
41                   (if (ly:context-def? cdef)
42                       (let ((accepts (ly:context-def-lookup cdef 'accepts)))
43                         (if (and (memq from accepts)
44                                  (not (memq to accepts)))
45                             (variable-set! var
46                                            (ly:context-def-modify cdef cmod))))))))
47           module)
48          (ly:parser-error (_ "Not in an output definition")))))