- /* finally for a melisma */
- if(h->has_interface (ly_symbol2scm ("melisma-interface"))) {
- String voice_context_id = get_context_id(i.origin_trans_l_->daddy_trans_l_, "Voice");
- record_melisma(voice_context_id);
+
+ /* Catch any extender items and then if we have a melisma,
+ set the RIGHT item of the extender spanner to the melismatic note in
+ the corresponding context (if any).
+ This has the effect of finishing the extender under the last note
+ of the melisma, instead of extending it to the next lyric.
+
+ Problem: the extender request is thrown at the same moment as the next lyric,
+ by which time we have already passed the last note of the melisma.
+ However, the Lyric_phrasing_engraver remembers the last note, so just
+ attach it to that, provided it was melismatic. If it was not melismatic,
+ then ignore it and let the Extender_engraver take care of it (i.e. finish at next
+ lyric).
+ */
+ if(h->has_interface (ly_symbol2scm ("lyric-extender-interface"))) {
+ String voice_context_id = get_context_id(i.origin_trans_l_->daddy_trans_l_, "LyricVoice");
+ record_extender(trim_suffix(voice_context_id), h);