Hi,
I tried to adapt the syntax-trickery David showed with the new
\tweak-definition to an own function.
Trying a code like the tiny example below fails.
proc =
#(define-music-function (parser location name arg)((string?) ly:music?)
(if name
#{ \once \override $name #'color = #red $arg #}
#{ \parenthesize $arg #}))
\relative c' {
c1
\proc "NoteHead" c
\proc c
}
Obviously I did sth wrong.
Well, I could do:
#(define-public (string-or-music? x)
(or (string? x) (ly:music? x)))
procII =
#(define-music-function (parser location arg)(string-or-music?)
(if (string? arg)
#{ \once \override $arg #'color = #red #}
#{ \parenthesize $arg #}))
\relative c' {
c1
\procII "NoteHead" c
\procII c
}
But I'd prefer the first version.
How to do?
-Harm
_______________________________________________
lilypond-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-devel