Am 01.11.19 um 16:01 schrieb Thomas Morley:
Am Fr., 1. Nov. 2019 um 15:34 Uhr schrieb Karsten Reincke <k.rein...@fodina.de>:
does anyone has / know about an example of a define-markup-command
implementation
using a variable number of arguments / parameters?
Nope, optional arguments are not possible using define-markup-command.
Unfortunately, in my system (Linux Ubuntu 19.10 with Lilypond 2.18...) the
normal
GUILE / scheme syntax (define (x y . args) ) (doanythingwith args) ) seems to
executable.
The tutorial LilyPond Extending mentions that there exist such an opportunity
(page 19.), but does not contain any example.
The section of the Extending-tutorial refers to functions, not to the
define-markup-command which is a macro.
(At least if I've identified the section you refer to correctly, I
usually use the big-page-html-version of the docs.)
You could go for properties (see define-markup-commands.scm), but the
syntax in coding and calling it differs ofcourse and you may encounter
unwished side-effects (if namings interfer with grob-properties).
For variable amount of args I'd go for list? (or the like) and let the
body of your code sort it out.
An approach that I personally like very much for its way the input code
"speaks" is the \with {} clause. You use that by the ly:context-mod?
predicate and then you can stuff arbitrary key=value pairs in it (and
parse that within the body, as Harm said).
Urs
Cheers,
Harm