[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What is the deal with define-internal-markup-command?

From: Nicolas Sceaux
Subject: Re: What is the deal with define-internal-markup-command?
Date: Thu, 12 Nov 2009 21:32:57 +0100

Le 12 nov. 2009 à 20:45, David Kastrup a écrit :

Why does define-internal-markup-command have more arguments than

I think you mean define-builtin-markup-command.

 One is the doc, but there also seem to be
default properties.  Why doesn't define-markup-command have properties
to specify as well?

One extra argument is the category of the command, and the second is
the properties that are read from the `props' arguments, and their default
value. Both are for documentation purpose (even though the second as an
extra functionality), see:
< >
You'll see the categories, and for each command documentation, the used
properties, with the default values.

Historically, there was a single define-markup-command. Then, a distinction between builtin and user-defined ones was introduced, so that user- defined
commands do not pollute the internal LilyPond module.

Then, the two commands diverged, two extra arguments being added to the builtin
version, to ease the documentation generation.

The properties argument could have been added to the user version, but that was not done, mainly not to break existing user code: it's more difficult to
add convert-ly rules to scheme code.

If you'd like the same kind of facility (ie automatically getting property values, binding them to symbols, and defining default values), I'd suggest
defining a macro, eg. with-properties, which would be used like that:

(define-markup-command (my-command layout props arg) (signature...)
   (with-properties props ((thickness 0.1)
                           (baseline-skip 3))
     ... use arg, thickness and baseline-skip to make a stencil ...))

This way, existing code is not broken and the same binding functionality is


reply via email to

[Prev in Thread] Current Thread [Next in Thread]