|
From: | Urs Liska |
Subject: | Re: Discuss signature for new function \annotate |
Date: | Thu, 06 Jun 2013 13:57:15 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 |
Am 06.06.2013 13:35, schrieb David
Kastrup:
Hm, I think I see what you mean,Urs Liska <address@hidden> writes:Am 06.06.2013 12:22, schrieb David Kastrup:If your first argument is something like Script, you might want to make it of type symbol? instead. I actually have a syntax sanitizing patch in limbo where unquoted words are not accepted as strings. It is not going to make it into 2.18, but I don't promise I won't push it at some later point of time.What type is the 'grob' argument of \shape?<URL:http://lilypond.org/doc/v2.17/Documentation/notation/available-music-functions#index-shape-1> shape [music] - offsets (list) item (symbol list or music) Offset control-points of item by offsets. The argument is a list of number pairs or list of such lists. Each element of a pair represents an offset to one of the coordinates of a control-point. If item is a string, the result is \once\override for the specified grob type. If item is a music _expression_, the result is the same music _expression_ with an appropriate tweak applied. The documentation string states "If item is a string", but that's actually inaccurate and would warrant fixing.And: with \shape the order of arguments was reversed for syntactical reasons (that I didn't really understand).When commands with arguments are used as tweaks on a music _expression_, multiple such commands combine quite awfully when the music _expression_ is not consistently the last argument.I would also like to \annotate e.g. individual notes from chords etc. So what would I have to take care of?Putting an "item" of type symbol-list-or-music? last seems like a reasonably good idea. but if I write annotate = #(define-void-function (parser location type properties annotation item) (string? list? string? symbol-list-or-music?)) \relative g' { \annotate "critremark" #'() "Tenuto added as in Vc. 2" Script g1-- }
Obviously I'm missing that extra bit outside your quote.It is probably worth considering to make properties of type context-mod? (potentially optional), then you can write the argument as \with { voice = "vc1" source = "Ms. 2" author = "Urs Liska" date = "2013-06-06" }That looks very good. How would the values then be accessed? Are they simple variables inside the function? Or does that also create an alist internally annotate = #(define-void-function (parser location type properties annotation item) (string? context-mod? string? symbol-list-or-music?)) \relative g' { \annotate "critremark" \with { voice = "vc1" source = "Ms. 2" author = "Urs Liska" date = "2013-06-06" } "Tenuto added as in Vc. 2" { c } g1-- } gives me loads of errors about not being in lyricmode ... Thanks for theseLists. address@hidden:/usr/local/tmp/lilypond$ lilypond scheme-sandbox GNU LilyPond 2.17.20 Processing `/usr/local/share/lilypond/2.17.20/ly/scheme-sandbox.ly' Parsing... guile> (ly:get-context-mods #{ \with { voice = "vc1" source = "Ms. 2" } #}) ((assign voice "vc1") (assign source "Ms. 2")) guile>Of course, you might get unsets and overrides and reverts slipped in which you would want to weed out again, but list? is also prone to permitting a lot that you don't want to see.Sure. I'd have to iterate over the alist and ignore all keys I can't handle. But how would that be with a context-mod?guile> (ly:get-context-mods #{ \with { \unset voice \override Beam.stencil = ##f} #}) ((unset voice) (push Beam #f stencil)) Urs |
[Prev in Thread] | Current Thread | [Next in Thread] |