The LSR snippet "Controlling of the pitch range in a score" contains the
code for a function, colorizeOutOfRange. This function works at 2.14.2,
but doesn't at 2.15.40.
This can be demonstrated by compiling the following:
\include "./colorize.ly"
music = \relative c' { c d e f g a b }
\new Staff { \colorizeOutOfRange d' a' \music }
where the file colorize.ly contains the following code from the cited
snippet:
colorizeOutOfRange = #(define-music-function (parser location
low-note high-note music )(ly:music? ly:music?
ly:music?)
"Colorizes in red notes out of range `low-note `high-note"
(let* (
(low-elts (ly:music-property low-note 'elements))
(high-elts (ly:music-property high-note 'elements))
(low-pitch (and (pair? low-elts)
(ly:music-property (car low-elts) 'pitch)))
(high-pitch (and (pair? high-elts)
(ly:music-property (car high-elts) 'pitch))))
(if (and (ly:pitch? low-pitch)
(ly:pitch? high-pitch)
(ly:pitch<? low-pitch high-pitch))
(music-map
(lambda (evt)
(let ((p (ly:music-property evt 'pitch)))
(if (and (ly:pitch? p)
(or (ly:pitch<? p low-pitch)
(ly:pitch<? high-pitch p)))
(let ((tweaks (ly:music-property evt 'tweaks)))
(ly:music-set-property! evt 'tweaks
(acons 'color red tweaks))))
evt))
music)
music)))
When compiled with lilypond 2.14.2 the notes c and b are colored red.
When compiled with lilypond 2.15.40, all notes are black.
Does anyone know a fix for colorizeOutOfRange?