X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fpart-combiner.scm;h=88c0b88fa6be7d94d61f6d8f40c946176c449309;hb=22aae52b7159b1beaf2b094f744773f14ba147ef;hp=54f9ea4a57aeefe4a3389c6a779e85cc06d78c1d;hpb=f87c71b902750abad8bbfb22a565f9a3ffbc5e07;p=lilypond.git diff --git a/scm/part-combiner.scm b/scm/part-combiner.scm index 54f9ea4a57..88c0b88fa6 100644 --- a/scm/part-combiner.scm +++ b/scm/part-combiner.scm @@ -1,6 +1,6 @@ ;;;; This file is part of LilyPond, the GNU music typesetter. ;;;; -;;;; Copyright (C) 2004--2011 Han-Wen Nienhuys +;;;; Copyright (C) 2004--2012 Han-Wen Nienhuys ;;;; ;;;; LilyPond is free software: you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by @@ -149,7 +149,7 @@ Voice-state objects (define (activevector (reverse! quote-contents '())))))) + ;; recording-group-emulate returns an assoc list (reversed!), so + ;; hand it a proper unique context name and extract that key: + (ctx-spec (context-spec-music mus 'Voice voicename)) + (listener (ly:parser-lookup parser 'partCombineListener)) + (context-list (reverse (recording-group-emulate ctx-spec listener))) + (raw-voice (assoc voicename context-list)) + (quote-contents (if (pair? raw-voice) (cdr raw-voice) '()))) + + ;; If the context-specced quoted music does not contain anything, try to + ;; use the first child, i.e. the next in context-list after voicename + ;; That's the case e.g. for \addQuote "x" \relative c \new Voice {...} + (if (null? quote-contents) + (let find-non-empty ((current-tail (member raw-voice context-list))) + ;; if voice has contents, use them, otherwise check next ctx + (cond ((null? current-tail) #f) + ((and (pair? (car current-tail)) + (pair? (cdar current-tail))) + (set! quote-contents (cdar current-tail))) + (else (find-non-empty (cdr current-tail)))))) + + (if (not (null? quote-contents)) + (hash-set! tab name (list->vector (reverse! quote-contents '()))) + (ly:music-warning mus (ly:format (_ "quoted music `~a' is empty") name)))))