+void
+execute_override_property (Context *context,
+ SCM context_property,
+ SCM grob_property_path,
+ SCM new_value)
+{
+ SCM current_context_val = SCM_EOL;
+
+ Context *where = context->where_defined (context_property,
+ ¤t_context_val);
+
+ /*
+ Don't mess with MIDI.
+ */
+ if (!where)
+ return;
+
+ if (where != context)
+ {
+ SCM base = updated_grob_properties (context, context_property);
+ current_context_val = scm_cons (base, base);
+ context->set_property (context_property, current_context_val);
+ }
+
+ if (!scm_is_pair (current_context_val))
+ {
+ programming_error ("Grob definition should be cons");
+ return;
+ }
+
+ SCM target_alist = scm_car (current_context_val);
+
+ /*
+ If the car is a list, the property path comes from a nested override
+ using list syntax inside a \context block
+ */
+ if (scm_is_pair (scm_car (grob_property_path)))
+ grob_property_path = scm_car (grob_property_path);
+
+ SCM symbol = scm_car (grob_property_path);
+ if (scm_is_pair (scm_cdr (grob_property_path)))
+ {
+ new_value = nested_property_alist (ly_assoc_get (symbol, target_alist,
+ SCM_EOL),
+ scm_cdr (grob_property_path),
+ new_value);
+ }
+
+ /* it's tempting to replace the head of the list if it's the same
+ property. However, we have to keep this info around, in case we have to
+ \revert back to it.
+ */
+ target_alist = scm_acons (symbol, new_value, target_alist);