Am So., 23. Aug. 2026 um 18:42 Uhr schrieb Richard Shann
<[email protected]>:
>
> Denemo has a version of Graham Percival's live-score.ily to annotate
> LilyPond's SVG output with line and column information for each note
> and rest in a score. With LilyPond version 2.26 this is not working -
> the SVG output contains <g id=""> instead of the line and column
> information e.g. <g id="Note-12-10">. In the documentation it says
> output-attributes.id can be set to symbols - in this case it is set to
> a procedure expecting a grob argument. It's not clear if that is an
> acceptable value, but appears to have worked for the last ten years.
> This is the procedure definition and the override that is used
>
> %%%%%%%%%%%%%%%%%%%%%%%%%
> #(define (note-id grob)
>    (let* ((origin (ly:input-file-line-char-column
>                    (ly:event-property (ly:grob-property grob 'cause) 
> 'origin))))
>   (string-concatenate
>     (list
>       "Note-"
>       (ly:format "~a-~a"
>         (cadr origin)
>         (caddr origin))))))
>
> \override NoteHead.output-attributes.id = #note-id
>
> %%%%%%%%%%%%%%%%%%%%
> The full include file is attached (after convert-ly) - it has a lot of
> redundant code as all Denemo needs is the location of notes and rests
> in the LilyPond score.
> My question is, has something changed to make this fail?
>
> Richard Shann

I seem to remember: in a nested list a sublist can not be set to a
procedure while doing a grob override.
If this is correct I wonder why that code ever worked.

Ofcourse you can use the _result_ of a procedure to construct said nested list:

#(define (note-id grob)
  (let* ((origin (ly:input-file-line-char-column
                   (ly:event-property (ly:grob-property grob 'cause) 'origin))))
    (ly:format "Note-~a-~a"
      (cadr origin)
      (caddr origin))))

{
  \override NoteHead.output-attributes =
    #(grob-transformer 'output-attributes
      (lambda (grob orig) (cons (cons 'id (note-id grob)) (or orig '()))))

  a1
  \break
  b1
}

Does this work for you?

Cheers,
  Harm

Reply via email to