From 30dde009eb3f8658ea068510a4d6bcfe433dc84b Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Wed, 14 Dec 2011 17:28:48 +0100 Subject: [PATCH] Let \parallelMusic flatten sequential music to support using functions better --- ly/music-functions-init.ly | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index 038f2ef6ac..02e6b8647e 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -763,10 +763,16 @@ Example: (and (not (null? origins)) (car origins))))))) ;; ;; first, split the music and fill in voices - (for-each (lambda (m) - (push-music m) - (if (bar-check? m) (change-voice))) - (ly:music-property music 'elements)) + ;; We flatten direct layers of SequentialMusic since they are + ;; pretty much impossible to avoid when writing music functions. + (let rec ((music music)) + (for-each (lambda (m) + (if (eq? (ly:music-property m 'name) 'SequentialMusic) + (rec m) + (begin + (push-music m) + (if (bar-check? m) (change-voice))))) + (ly:music-property music 'elements))) (if (not (null? current-sequence)) (change-voice)) ;; un-circularize `voices' and reorder the voices (set! voices (map-in-order (lambda (dummy seqs) -- 2.39.2