]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/part-combiner.scm
Fix 1214: cueDuring and quoteDuring should also quote voices that create subvoices
[lilypond.git] / scm / part-combiner.scm
index f5a2feae3ff67367fba5597fbb815ce00417805b..54f9ea4a57aeefe4a3389c6a779e85cc06d78c1d 100644 (file)
@@ -200,8 +200,9 @@ Voice-state objects
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (define-public (recording-group-emulate music odef)
-  "Interprets music according to odef, but stores all events in a chronological
-list, similar to the Recording_group_engraver in 2.8 and earlier"
+  "Interpret @var{music} according to @var{odef}, but store all events
+in a chronological list, similar to the @code{Recording_group_engraver} in
+LilyPond version 2.8 and earlier."
   (let*
      ((context-list '())
       (now-mom (ly:make-moment 0 0))
@@ -259,7 +260,7 @@ list, similar to the Recording_group_engraver in 2.8 and earlier"
     m))
 
 (define-public (determine-split-list evl1 evl2)
-  "EVL1 and EVL2 should be ascending"
+  "@var{evl1} and @var{evl2} should be ascending."
   (let* ((pc-debug #f)
         (chord-threshold 8)
         (voice-state-vec1 (make-voice-states evl1))
@@ -462,7 +463,7 @@ Only set if not set previously.
            (previous-voice-state vs)))
 
       (define (try-solo type start-idx current-idx)
-       "Find a maximum stretch that can be marked as solo. Only set
+       "Find a maximum stretch that can be marked as solo.  Only set
 the mark when there are no spanners active.
 
       return next idx to analyse.
@@ -497,7 +498,7 @@ the mark when there are no spanners active.
            start-idx))
 
       (define (analyse-moment result-idx)
-       "Analyse 'apart starting at RESULT-IDX. Return next index. "
+       "Analyse 'apart starting at RESULT-IDX.  Return next index."
        (let* ((now-state (vector-ref result result-idx))
               (vs1 (current-voice-state now-state 1))
               (vs2 (current-voice-state now-state 2))
@@ -570,10 +571,18 @@ the mark when there are no spanners active.
 
 (define-public (add-quotable parser name mus)
   (let* ((tab (eval 'musicQuotes (current-module)))
-        (context-list (recording-group-emulate (context-spec-music mus 'Voice)
-                                               (ly:parser-lookup parser 'partCombineListener))))
-    (if (pair? context-list)
-       (hash-set! tab name
-                  ;; cdr : skip name string
-                  (list->vector (reverse! (cdar context-list)
-                                          '()))))))
+         ;; If a Voice is passed, use its contents:
+         (contents (if (equal? (ly:music-property mus 'name) 'ContextSpeccedMusic)
+                       (ly:music-property mus 'element)
+                       mus))
+         (voicename (get-next-unique-voice-name))
+         ;; recording-group-emulate returns an assoc list, so hand it a
+         ;; proper unique context name and extract that key:
+         (context-list (recording-group-emulate (context-spec-music contents 'Voice voicename)
+                                                (ly:parser-lookup parser 'partCombineListener)))
+         (quote-contents (if (assoc voicename context-list)
+                             (assoc-get voicename context-list)
+                             '())))
+
+    (if quote-contents
+        (hash-set! tab name (list->vector (reverse! quote-contents '()))))))