lilypond-user
[Top][All Lists]
Advanced

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

Re: Discuss signature for new function \annotate


From: Urs Liska
Subject: Re: Discuss signature for new function \annotate
Date: Thu, 06 Jun 2013 15:41:03 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130510 Thunderbird/17.0.6

Am 06.06.2013 14:16, schrieb David Kastrup:
Putting an "item" of type symbol-list-or-music? last seems like a
reasonably good idea.
Hm, I think I see what you mean,
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--
}


I get an error "Zu viel Vorgriff" (too much read-ahead?).
If I replace 'Script' with '{ c }' for example it compiles without message.
???
And if you do

annotate =
#(define-music-function (parser location type properties annotation item)

    (string? list? string? symbol-list-or-music?) #{ #})

it also compiles fine (which explains why \shape does not blow up around
our ears).

Looks like I have something more to fix in the parser...
Sorry, I don't quite get what this actually means or implies.
Can't I use that signature? Or can't I use it for now? Should I think about something different?

When I replace symbol-list-or-music? with symbol? as the last parameter it compiles fine with 'Script' for example. So I could use that for now and only use it for grobs (and not as a postfix tweak) (?).

Am 06.06.2013 15:34, schrieb David Kastrup:
Stupid question: independent of me fixing this, wouldn't your function
actually be supposed to return some music expression anyway?  If so,
using a music function defined as #{ #} for the testing phase should be
sufficient for avoiding this parser problem.
Well, that's not stupid, but essential.
My function may or may not return a music expression depending on some flags. So I'll have to write a music function that eventually returns an empty music expression, isn't it?

That seems to work. (for now, as usual ...)
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
Obviously I'm missing that extra bit outside your quote.
annotate =
#(define-void-function (parser location type properties annotation item)
    (string? context-mod? string? symbol-list-or-music?))
You mean ly:context-mod?
Yes, that's it. As said that missing extra bit I didn't get from your suggestion.
Now it works





reply via email to

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