]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 3553/1: get_default_interpreter should create contexts with missing context_id
authorDavid Kastrup <dak@gnu.org>
Thu, 12 Sep 2013 17:25:17 +0000 (19:25 +0200)
committerDavid Kastrup <dak@gnu.org>
Fri, 20 Sep 2013 15:23:26 +0000 (17:23 +0200)
At the current point of time, an existing bottom context is returned
even when there is a mismatch in ids.  For example, when writing

\context Voice = "one" <<
  { \voiceOne g' g' g' g' }
  \context Voice = "two" { \voiceTwo c' c' c' c' }
>>

creates two voices, while

\context Bottom = "one" <<
  { \voiceOne g' g' g' g' }
  \context Bottom = "two" { \voiceTwo c' c' c' c' }
>>

only uses a single Voice called "one".  This is arguably wrong.

lily/context.cc

index 8d44ca8f85c67d43c4ee5ab596839e2cd40e37cf..c72e9eeb25e901f250e4708c04c707542fc4ecb1 100644 (file)
@@ -429,6 +429,13 @@ Context::get_default_interpreter (const string &context_id)
       Context *tg = create_context (t, context_id, SCM_EOL);
       return tg->get_default_interpreter (context_id);
     }
+  else if (!context_id.empty () && context_id != id_string ())
+    {
+      if (daddy_context_ && !dynamic_cast<Global_context *> (daddy_context_))
+        return daddy_context_->get_default_interpreter (context_id);
+      warning (_f ("cannot find or create new Bottom = \"%s\"",
+                   context_id.c_str ()));
+    }
   return this;
 }