Hi Harm,

Am 10.06.2018 um 15:15 schrieb Thomas Morley:
2018-06-09 23:59 GMT+02:00 Urs Liska <li...@openlilylib.org>:

You mean I should use set-object-property! rather than set!
(ly:music-property .... ?
Well, look at the example below (for custom-grob-properties):

{
   \override NoteHead #'wtf = ##t
   c'
   d'
   \once \override NoteHead #'color =
   #(lambda (grob)
     (if (eq? (ly:grob-property grob 'wtf) #t)
         red
         '()))
   e'
   f'
}

This used to work, alas emitting a warning:
warning: cannot find property type-check for `wtf' (backend-type?).
perhaps a typing error?
warning: doing assignment anyway

Since 2.18.2 it fails with:
warning: cannot find property type-check for `wtf' (backend-type?).
perhaps a typing error?
warning: skipping assignment

Unless you prepend the example with something at the lines of:

#(define (define-grob-property symbol type? description)
   (if (not (equal? (object-property symbol 'backend-doc) #f))
       (ly:error (_ "symbol ~S redefined") symbol))

   (set-object-property! symbol 'backend-type? type?)
   (set-object-property! symbol 'backend-doc description)
   symbol)

#(for-each
   (lambda (x)
     (apply define-grob-property x))
     `(
       (wtf ,boolean? "DOCME")
       ;; other custom-properties
       ))

I just thought doing similar for custom-_music_-properties would be a
littel more robust for changes of our internals.

Thanks. Now that I've looked more closely I see your point.


Does that also work with whole music expressions (vs. single grobs)? I want
to "tag" the whole (sequential) music expression.
I expect so, but didn't check.


Indeed it does.
But now that I know how to mark up a whole music expression with a custom music-property I see that it may not actually be what I need. Is it possible to read out the properties of music expressions in an engraver? Or do these only respond to grobs? Is *that* what (process-music) is for?

What I want to achieve is:

 * Have a music function take a music argument
 * mark that up with an annotation (that addresses the whole
   expression, not just a single grob or moment)
 * in an engraver process the annotation as a whole, for example in
   order to print the begin and end of the annotated music.

If that isn't possible with the music-property I would probably attach grob-properties to the first and last element in the music expression and try to figure out the extent of the annotation by that (will probably have to do some ID referencing to match the begin/end grobs).


Urs


Cheers,
   Harm

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to