Re: Allowable values for output-attributes.id

Richard Shann <[email protected]>
Newsgroups gmane.comp.gnu.lilypond.general
Message-ID <[email protected]>
On Mon, 2026-08-24 at 12:27 +0200, Thomas Morley wrote:
> 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?

Yes, indeed it does - thank you very much.
I've noticed that I have another 2.26 upgrade problem the vibrato code
(wavy line above notes) which I think you wrote originally. It seems
this works with 2.26 but gets broken by applying convert-ly! But that's
for a separate thread.
Richard
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.