- Item *g = dynamic_cast<Item *> (unsmob_grob (scm_cdar (s)));
-
- if (g && !g->get_column ()
- && Note_head::has_interface (g))
- return g;
+ Grob *g = Grob::unsmob (scm_cdar (s));;
+ Moment *end_mom = Moment::unsmob (scm_caar (s));
+ if (!end_mom || !g)
+ {
+ programming_error ("busyGrobs invalid");
+ continue;
+ }
+
+ // It's a bit irritating that we just have the length and
+ // duration of the Grob.
+ Moment end_from_now =
+ get_event_length (Stream_event::unsmob (g->get_property ("cause")), now)
+ + now;
+ // We cannot actually include more than a single grace note
+ // using busyGrobs on ungraced lyrics since a grob ending on
+ // grace time will just have disappeared from busyGrobs by the
+ // time our ungraced lyrics appear. At best we may catch a
+ // single grace note.
+ //
+ // However, a single grace note ending on a non-grace time is
+ // indistinguishable from a proper note ending on a non-grace
+ // time. So we really have no way to obey includeGraceNotes
+ // here. Not with this mechanism.
+ if ((*end_mom == end_from_now)
+ && dynamic_cast<Item *> (g)
+ && Note_head::has_interface (g))
+ {
+ return g;
+ }