openlilylib / scholarly

ScholarLY, a library for annotating LilyPond scores
GNU General Public License v3.0
24 stars 6 forks source link

apply editorial commands: point-and-click with music functions #41

Open uliska opened 8 years ago

uliska commented 8 years ago

When applying editorial commands and they are eventually music functions the point-and-click links don't point to the origin but to the place of invocation in __main__.ily.

This somehow has to do with how music functions create music expressions, as can be seen from the following example:

\version "2.19.47"

funcA =
#(define-music-function (mus)(ly:music?)
   #{
     #mus
   #})

funcB =
#(define-music-function (mus)(ly:music?)
   #{
     \once \override NoteHead.color = #red
     #mus
   #})

funcC =
#(define-music-function (mus)(ly:music?)
   #{
     {
       #mus
     }
   #})

funcD =
#(define-music-function (mus)(ly:music?)
   #{
     \once \override NoteHead.color = #blue
     {
       #(parenthesize mus)
     }
   #})

funcF =
#(define-music-function (mus)(ly:music?)
   #{
     {
       \override NoteHead.color = #green
       \parenthesize { #mus }
     }
   #})

{
  % funcA: point-and-click points tofunction invocation
  \funcA c'
  % funcB: point-and-click points to music
  \funcB d'
  % funcC: point-and-click *also* points to function invocation
  \funcC e'
  % funcD: point-and-click points to invocation of (parenthesize)
  \funcD f'
  % funcF: point-and-click is correct but parenthesis is not printed
  \funcF g'
}