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 (new version)


From: Urs Liska
Subject: Re: Discuss signature for new function \annotate (new version)
Date: Wed, 12 Jun 2013 17:34:02 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130510 Thunderbird/17.0.6

On 06/12/2013 05:18 PM, Urs Liska wrote:
On 06/12/2013 05:10 PM, Paul Morris wrote:
Urs Liska wrote
BTW: How can I read such properties in a Scheme function, i.e. determine
where we are in a piece when a function is executed?
I didn't find it in the manual ...
http://www.lilypond.org/doc/v2.17/Documentation/extending/object-properties
says that object properties are stored in alist-chains.
So I'm looking for an entry '(currentBarNumber . N) of the Score object.
But that doesn't help me unfortunately.

How would I write if I want something like

(define curNum Score.currentBarNumber)
?
Maybe this snippet will help show how to do this?
http://lsr.dsi.unimi.it/LSR/Item?id=333
Looks promising, but I'm too tired to digest that right now ...
Thanks

Actually, when looking at the snippet I looked up \applyContext, and guess what I find there?
http://www.lilypond.org/doc/v2.17/Documentation/extending/context-evaluation#index-_005capplyContext

\applyContext function

function should be a Scheme function that takes a single argument: the context in which the \applyContext command is being called. The following code will print the current bar number on the standard output during the compile:

\applyContext
  #(lambda (x)
    (format #t "\nWe were called in barnumber ~a.\n"
     (ly:context-property x 'currentBarNumber)))
:-)

reply via email to

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