\version "2.18.2" annotate = #(define-music-function (parser location properties item) (ly:context-mod? symbol-list-or-music?) ;; annotates a musical object for use with lilypond-doc (let* ( ;; create dummy alist (is that necessary?) (props '( ))) ;; Add or replace props entries taken from the properties argument (map (lambda (mod) (set! props (assoc-set! props (symbol->string (cadr mod)) (caddr mod)))) (ly:get-context-mods properties)) ;; produce a clickable message (ly:input-message location "Annotation") ;; Print a message with all properties to the console (map (lambda (prop) (ly:message (format " ~a: ~a" (car prop) (cdr prop)))) props) (ly:message "\n")) ;; Color the affected grob #{ \tweak color #darkgreen #item #}) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Usage example { \annotate \with { author = "Urs Liska" message = "Important information" } NoteHead -> d' e' }