David Kastrup <d...@gnu.org> writes: > Dan Eble <d...@faithful.be> writes: > >> %{ >> NullVoice is unlike a Voice in this respect: trying to move it to a >> different Staff with \change fails with this warning: >> >> Change_iterator::process (): NullVoice = `soprano': >> cannot change `Staff' to `S': not changing to same context type: Staff >> >> Apart from the warning, this is inconvenient. The NullVoice remaining >> in the original staff keeps the original staff alive, demanding manual >> work to make it disappear. >> >> The NullVoice context definition contains both of the following: >> >> \alias "Staff" >> \alias "Voice" >> >> My knowledge of contexts is not extensive, but I suggest that the test >> that \change applies is too simple. > > The test is > > else if (it.get_outlet ()->is_alias (to_type)) > { > // No enclosing context was found because the iterator's immediate > // context is the kind that was sought. > /* We could change the current translator's id, but that would make > errors hard to catch. > > last->translator_id_string () = get_change > ()->change_to_id_string (); */ > result = _f ("not changing to same context type: %s", ly_symbol2string > (to_type).c_str ()); > } > > and that's indeed crapola. What the test should do is check whether the > current context type would be accepted into the hierarchy of the > proposed parent.
Well, that's a bit too simplistic because there is no "current context type". For something like \change StaffGroup = "what" the change iterator looks at the current context hierarchy upwards until it finds a "StaffGroup" as a parent. The layer below that is the context to move, and if it is significantly similar in specification to the context that should be/become its parent, it might become hard to move back and forth. So it's likely a bit of work/thought to make sure one does not create context trapdoors from which it is hard to escape. Hovercraft parent contexts. -- David Kastrup _______________________________________________ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond