One more understanding question regarding contexts and engravers.
If I \consist an engraver in a bottom context like Voice I can travel up the chain of parent contexts, retrieving their name and id properties. But if I \consist it in Staff level contexts I don't see if/how I can get to the bottom-level context a grob is possibly in.
The issue is: the annotations I'm working on check the context's context-id to determine if it has an explicit name (for example "Flute 3"). It can travel upwards to find names like "Flutes staff", "winds" or "my-score".
In order to be able to catch explicit names on voice level I need to \consist the engraver to all bottom contexts. But then staff-level grobs like time signatures are of course not detected in the engraver. If on the other hand I \consist the engraver to the staff-level contexts explicit voice-level names are not found.
One solution I think would work to \consist the engraver in both bottom and staff-level contexts. Originally that would cause voice-level grobs to be processed twice (resulting in duplicate annotations) but I can avoid that by checking if the grob has already been recorded. This would require one (if (not (memq grob all-grobs))) check for each acknowledged grob, with all-grobs seemingly of length between 0 and 40 (from what I've seen so far).
Anyway, even if it works it seems somewhat inefficient and hacky to me to \consist the engraver to both Voice and Staff and filter out matches that way. So it would seem more plausible if it is possible to get to the bottom context's name and id from a staff-level engraver. Is that possible?
Well, a final solution would be to simply not support voice-level explicit names and start on staff-level. Usually that is what one wants to see anyway, but I can imagine one would still want to see the voice-level names, for example in comined parts where I would want the annotation to announce "flute 2" rather than "flutes".
Urs _______________________________________________ lilypond-user mailing list email@example.com https://lists.gnu.org/mailman/listinfo/lilypond-user