Use scalar instead of embedded_scm for context mod overrides.
[lilypond/mpolesky.git] / ly / chord-repetition-init.ly
blob3ff4578b60da24402d4d2173809a831b87f3c358
1 \version "2.13.8"
2 %{
3 Two functions define the chord repetition behavior, and may
4 be invoked by the user to customize it.
6 ly:parser-set-repetition-symbol
7 set the chord repetition shortcut.
8 `q' is the default value set in this file.
10 ly:parser-set-repetition-function
11 set the function that is invoked when a chord repetition symbol
12 is encountered by the parser: a three argument function
13 (previous-chord, duration, list of articulations) which is supposed
14 to return a new chord.
15 `default-repeat-chord' is the default function set in this file.
18 #(define-public (default-repeat-chord previous-chord duration articulations)
19 "Copy the previous chord, filter out events which are not notes, set the
20 chord duration, add articulations."
21 (let ((new-chord (ly:music-deep-copy previous-chord)))
22 (set! (ly:music-property new-chord 'elements)
23 (append! articulations
24 (filter (lambda (event)
25 (eqv? (ly:music-property event 'name) 'NoteEvent))
26 (ly:music-property new-chord 'elements))))
27 (for-each (lambda (event)
28 (if (ly:duration? (ly:music-property event 'duration))
29 (set! (ly:music-property event 'duration) duration)))
30 (ly:music-property new-chord 'elements))
31 new-chord))
33 #(ly:parser-set-repetition-symbol parser 'q)
34 #(ly:parser-set-repetition-function parser default-repeat-chord)