- 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->internal_set_property (context_property, current_context_val);
- }
-
- if (!scm_is_pair (current_context_val))
- {
- programming_error ("Grob definition should be cons");
- return;
- }
-
- SCM prev_alist = scm_car (current_context_val);
- SCM symbol = scm_car (grob_property_path);
- SCM target_alist
- = lookup_nested_property (prev_alist,
- scm_reverse (scm_cdr (grob_property_path)));
-
- target_alist = scm_acons (symbol, new_value, target_alist);
-
- bool ok = true;
- if (!scm_is_pair (scm_cdr (grob_property_path)))
- {
- if (!ly_is_procedure (new_value)
- && !is_simple_closure (new_value))
- ok = type_check_assignment (symbol, new_value,
- ly_symbol2scm ("backend-type?"));
-
- /*
- tack onto alist. We can use set_car, since
- updated_grob_properties() in child contexts will check
- for changes in the car.
- */
- if (ok)
- {
- scm_set_car_x (current_context_val, target_alist);
- }
- }
- else
- {
- execute_general_pushpop_property (context,
- context_property,
- scm_cdr (grob_property_path),
- target_alist
- );
- }
+ 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);
+
+ bool ok = true;
+ bool pc = is_unpure_pure_container (new_value);
+ SCM vals[] = {pc ? unpure_pure_container_unpure_part (new_value) : new_value,
+ pc ? unpure_pure_container_pure_part (new_value) : SCM_BOOL_F};
+
+ for (int i = 0; i < 2; i++)
+ if (!ly_is_procedure (vals[i])
+ && !is_simple_closure (vals[i]))
+ ok = ok && type_check_assignment (symbol, vals[i],
+ ly_symbol2scm ("backend-type?"));
+
+ /*
+ tack onto alist. We can use set_car, since
+ updated_grob_properties () in child contexts will check
+ for changes in the car.
+ */
+ if (ok)
+ {
+ scm_set_car_x (current_context_val, target_alist);