Hi all,

in the ScholarLY package we're attaching a (newly defined) property
'input-annotation to a grob, either through an implicit \once \override
or a \tweak, depending on the invocation syntax:

The attached file
    annotate.ly
shows both ways, first the override, then the tweak. Today I finally
realized that the "tweaked" ones are not processed properly, that is,
while they are attached to the grob they aren't retrieved in the later
engraver processing.

The output of \displayMusic (attachment display-music) shows the
different ways the annotations are attached to the grobs:

The first one provides an explicit override, and so 'input-annotation is
a property of the following note. This can be retrieved with
ly:grob-property (which works in
https://github.com/openlilylib/scholarly/blob/master/annotate/engraver.ily#L66).

The second one is the result of an implicit \tweak where it is fond in
the 'tweaks property of the music expression.

So, my question is: if I'm iterating over the grobs in an engraver's
acknowledger (as per the link above), how can I first determine if the
grob('s music) has a 'tweaks property and second retrieve that property?
I have been able to retrieve the thing through selecting from a
ly:grob-alist-chain, but that seems cumbersome and error-prone. There
must be an easier way. However, ly:music-property which should be the
way to go here doesn't seem possible because I (think I) can't reference
the "music" argument here.

OMG, I have the impression this request is completely uncomprehensible ...

Best
Urs
\version "2.19.45"

\include "scholarly/package.ly"

test = {
  % First invocation, attaches the 'input-annotation as a \once \override
  \musicalIssue \with {
    message = "A test"
  }
  Accidental
  cis'4

  % Second invocation, attaches a \tweak
  \criticalRemark NoteHead \with {
    message = "Test"
  }
  c'4 d'
}

\displayMusic \test
(make-music
  'SequentialMusic
  'elements
  (list (make-music
          'SequentialMusic
          'elements
          (list (make-music
                  'NoteEvent
                  'tweaks
                  (list (list 'input-annotation
                              (list (quote input-file-name) "document.ly")
                              (cons (quote context-id) "tmpBD7bwR")
                              (cons 'location
                                    #<location 
/tmp/frescobaldi-qBazyK/tmpBD7bwR/document.ly:6:3>)
                              (cons (quote type) (quote critical-remark))
                              (cons (quote message) "Test")))
                  'duration
                  (ly:make-duration 2)
                  'pitch
                  (ly:make-pitch 0 0))
                (make-music
                  'NoteEvent
                  'pitch
                  (ly:make-pitch 0 1)
                  'duration
                  (ly:make-duration 2))))))

(make-music
  'SequentialMusic
  'elements
  (list (make-music
          'SequentialMusic
          'elements
          (list (make-music
                  'ContextSpeccedMusic
                  'context-type
                  'Bottom
                  'element
                  (make-music
                    'OverrideProperty
                    'once
                    #t
                    'pop-first
                    #t
                    'grob-value
                    (list (list (quote input-file-name) "document.ly")
                          (cons (quote context-id) "tmpBD7bwR")
                          (cons 'location
                                #<location 
/tmp/frescobaldi-qBazyK/tmpBD7bwR/document.ly:6:3>)
                          (cons (quote type) (quote critical-remark))
                          (cons (quote message) "Test"))
                    'grob-property-path
                    (list (quote input-annotation))
                    'symbol
                    'NoteHead))
                (make-music
                  'NoteEvent
                  'duration
                  (ly:make-duration 2)
                  'pitch
                  (ly:make-pitch 0 0))))
        (make-music
          'NoteEvent
          'pitch
          (ly:make-pitch 0 1)
          'duration
          (ly:make-duration 2))))
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to