- context ()->add_alias (ly_symbol2scm ("Timing"));
- context ()->set_property ("currentBarNumber", scm_from_int (1));
- context ()->set_property ("internalBarNumber", scm_from_int (1));
+ Context *timing = unsmob_context (scm_call_2 (ly_lily_module_constant ("ly:context-find"),
+ context ()->self_scm (),
+ ly_symbol2scm ("Timing")));
+ if (timing != context ())
+ {
+ context ()->add_alias (ly_symbol2scm ("Timing"));
+
+ if (!timing)
+ {
+ programming_error ("Can't find Timing context template");
+ timing = context ();
+ }
+ }
+
+ SCM barnumber = timing->get_property ("currentBarNumber");
+ if (!scm_is_integer (barnumber))
+ barnumber = scm_from_int (1);
+ context ()->set_property ("currentBarNumber", barnumber);
+ context ()->set_property ("internalBarNumber", barnumber);