Chord names entered in note mode are annotated in the pdf with a link leading to the corresponding position in the ly source file. But chord names entered in chord mode get either a link with an invalid position (versions <= 2.13.7 say line0 column0). or no link at all.

This seems to be because although the event chords which chord mode produces do have position info, the note events they contain don't (cf make-note-ev). Note mode adds position info to both. Note events without an 'origin property result in no link. After copying(?), the same note events have an 'origin property saying 'position unknown', which results in a link with invalid position.

With the workaround propagateOrigins (cf attachment), the chordmode note events are given the position info of their containing chord, and the resulting links are valid.

Cheers,
Robin


\version "2.13.12" % also 2.12.3, 2.10.33, 2.8.8. 
#(ly:set-option 'point-and-click #t) 
\paper { #(set-paper-size "a6") ragged-right = ##t  }

propagateOrigins =
#(define-music-function (parser location compound-mus) (ly:music?)
  (define (propagate-origin single-mus) 
    (if (memq 'event-chord (ly:music-property single-mus 'types))
      (let* ((loc (ly:music-property single-mus  'origin))
          (elm (ly:music-property single-mus 'elements)))
        (map (lambda (x) (set! (ly:music-property x 'origin) loc)) elm)))
    single-mus)  
  (music-map propagate-origin compound-mus))

indirect = \chordmode { c c } 

\context ChordNames { a a } % notemode: link with valid location
\context ChordNames \chordmode { b b } % inline chordmode: no link
\context ChordNames \indirect % stored chordmode: link with invalid location
\context ChordNames \propagateOrigins \chordmode { d d } % workaround
_______________________________________________
bug-lilypond mailing list
bug-lilypond@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-lilypond

Reply via email to