- cancellation_ = make_item ("KeyCancellation", key_ev_ ? key_ev_->self_scm () : SCM_EOL);
- cancellation_->set_property ("old-accidentals", last);
- cancellation_->set_property ("c0-position",
- get_property ("middleCPosition"));
+ SCM restore = SCM_EOL;
+ SCM *tail = &restore;
+ for (SCM s = last; scm_is_pair (s); s = scm_cdr (s))
+ {
+ if (scm_assoc (scm_caar (s), key) == SCM_BOOL_F)
+ {
+ *tail = scm_acons (scm_caar (s),
+ scm_from_int (0), *tail);
+ tail = SCM_CDRLOC (*tail);
+ }
+ }
+
+ if (scm_is_pair (restore))
+ {
+ cancellation_ = make_item ("KeyCancellation",
+ key_event_
+ ? key_event_->self_scm () : SCM_EOL);
+
+ cancellation_->set_property ("alteration-alist", restore);
+ cancellation_->set_property ("c0-position",
+ get_property ("middleCPosition"));
+ }