Wouldn't the <>\stopGroup extend the group one note too far?

On 05/02/17 10:06, Thomas Morley wrote:
2017-05-02 8:29 GMT+02:00 Urs Liska <u...@openlilylib.org>:
Hi all,

I'm trying to apply event functions to music passed into a music function
like that:

\version "2.19.57"

test =
#(define-music-function (mus)(ly:music?)
    #{
      #mus \startGroup
    #})

{
   \test c' d' e' f' \stopGroup
}


(of course this is not what I ultimately want to achieve, but the nucleus
from which I'll be able to continue on my own).

This fails with "error: syntax error, unexpected EVENT_IDENTIFIER". I think
it is because the #mus expression is somehow already complete (differently
from when used in regular input) and I have to somehow *apply* the
\startGroup event function to the #mus argument.

 From \displayMusic I can see that it is added as a NoteGroupingEvent to the
note's articulations, but I'd like to ask if there's a more straightforward
way to attach the event to the music than rebuilding the music expression in
Scheme.
OTOH I will want to do that for the first *and last* element in a music
expression (in order to apply the start and stop command to a sequence of
notes), so I may *have* to extract the Scheme representation anyway?

TIA
Urs



\layout {
   \context {
     \Voice
     \consists "Horizontal_bracket_engraver"
   }
}

test =
#(define-music-function (mus)(ly:music?)
    #{
       <>\startGroup
       $mus
       <>\stopGroup
    #})

{
   \test { c' d' e' f' }
}

Should do the trick.

Cheers,
    Harm

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to