And thanks again to the Scheme-master Aaron.
One last thing:
how can I arrange that function so to obtain output-attributes =
output-attributes + id ?
For example: if output-attributes is (('a' . 'aa') ('i' . 'ii')) it must
become: (('a' . 'aa') ('i' . 'ii') ('id' . 'foobar_1'))
On Wed, Dec 18, 2019 at 2:07 AM Aaron Hill <[email protected]> wrote:
> On 2019-12-17 4:21 pm, Paolo Prete wrote:
> > Hi Stefano,
> >
> > unfortunately, it doesn't increment the counter globally, and the two
> > ids
> > in the SVG file are identical
>
> You will need to define a music function so that the (serial) procedure
> is called on each occurrence. Here's an option that rolls in the
> counter logic:
>
> %%%%
> \version "2.19.83"
>
> token = #(let* ((ctr 0) (ctr! (lambda () (set! ctr (1+ ctr)) ctr)))
> (define-music-function (mus) (ly:music?)
> (let ((id (format #f "foobar_~a" (ctr!))))
> #{ \tweak output-attributes #`((id . ,id)) #mus #})))
>
> \relative { c'4 d8 -\token [ e ] f -\token [ g ] c,4 }
> %%%%
>
>
> -- Aaron Hill
>
>