+ get_music ()->origin ()->warning (warn1);
+}
+
+string
+Change_iterator::change_to (Music_iterator &it,
+ SCM to_type,
+ const string &to_id)
+{
+ string result; // error message
+
+ // Find the context that should have its parent changed.
+ Context *last = find_context_above_by_parent_type (it.get_outlet (), to_type);
+ if (last)
+ {
+ // Find the new parent.
+ Context *dest = find_context_near (it.get_outlet (), to_type, to_id);
+ if (dest)
+ {
+ send_stream_event (last, "ChangeParent", it.get_music ()->origin (),
+ ly_symbol2scm ("context"), dest->self_scm ());
+ }
+ else
+ /* FIXME: constant error message. */
+ it.get_music ()->origin ()->warning (_ ("cannot find context to switch to"));
+ }
+ else if (it.get_outlet ()->is_alias (to_type))
+ {
+ // No enclosing context of the right kind was found
+ // and the iterator's immediate context is the kind that was sought.
+
+ result = _f ("not changing to same context type: %s", ly_symbol2string (to_type).c_str ());
+ }
+ else
+ /* FIXME: incomprehensible message */
+ result = _ ("none of these in my family");
+
+ return result;