Am 01.03.2018 um 18:31 schrieb Stefano Troncaro:
...

@Urs, I not familiar with \with blocks, I'll take a look at the oll-core code and experiment a bit with it. Maybe I'll be able to help.


Look at https://github.com/openlilylib/scholarly/blob/master/usage-examples/annotate.ly to see an example for the syntax. Actually this does what you want: an unlimited number of optional arguments.

%%%
\version "2.19.80"

\include "oll-core/package.ily"

myVariableFunc =
#(define-void-function (opts mus)((ly:context-mod? #f) ly:music?)
   (let ((props
          (if opts
              (context-mod->props opts)
              '())))
     (for-each (lambda (prop)
                 (ly:message "Option '~a': '~a'" (car prop) (cdr prop)))
       props)
     mus))

\relative {
  c' d e f
  \myVariableFunc \with {
    first = "Hello"
    second = 124
    third = #'((a . red)(b . blue))
    fourth = #(ly:version)
    fifth = #display
  } g1
}
 %%%
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to