From: David Kastrup <dak@gnu.org>
Date: Mon, 8 Sep 2014 21:19:23 +0000 (+0200)
Subject: Derive melisma_busy state from child contexts when available
X-Git-Tag: release/2.19.14-1~5^2~4
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=899cc9ee6763b5dfc3442c7473be7b88fe70ce34;p=lilypond.git

Derive melisma_busy state from child contexts when available
---

diff --git a/lily/context.cc b/lily/context.cc
index 8a85165cfd..da18102401 100644
--- a/lily/context.cc
+++ b/lily/context.cc
@@ -812,14 +812,29 @@ set_context_property_on_children (Context *trans, SCM sym, SCM val)
 bool
 melisma_busy (Context *tr)
 {
-  SCM melisma_properties = tr->get_property ("melismaBusyProperties");
-  bool busy = false;
+  // When there are subcontexts, they are responsible for maintaining
+  // melismata.
+  SCM ch = tr->children_contexts ();
+  if (scm_is_pair (ch))
+    {
+      // all contexts need to have a busy melisma for this to evaluate
+      // to true.
+
+      do {
+        if (!melisma_busy (Context::unsmob (scm_car (ch))))
+          return false;
+        ch = scm_cdr (ch);
+      } while (scm_is_pair (ch));
+      return true;
+    }
 
-  for (; !busy && scm_is_pair (melisma_properties);
+  for (SCM melisma_properties = tr->get_property ("melismaBusyProperties");
+       scm_is_pair (melisma_properties);
        melisma_properties = scm_cdr (melisma_properties))
-    busy = busy || to_boolean (tr->get_property (scm_car (melisma_properties)));
+    if (to_boolean (tr->get_property (scm_car (melisma_properties))))
+      return true;
 
-  return busy;
+  return false;
 }
 
 bool