lilypond-user
[Top][All Lists]
Advanced

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

Re: Defining shortcuts for scheme code


From: Erik Sandberg
Subject: Re: Defining shortcuts for scheme code
Date: Thu, 16 Feb 2006 21:49:45 +0100
User-agent: KMail/1.8.3

On Thursday 16 February 2006 13.14, Thies Albrecht wrote:
> Hi everybody!
>
> To prevent having to use extensive scheme code inside my score I prefer
> to define shortcuts for often used code snippets, e.g. when setting
> ottavation on and off.
>
> In the following code example Point'n'click is turned off also IMHO I
> have only defined the shortcut without using it. Now I wonder if my way
> of defining shortcuts is okay or if I've misunderstood the documentation
> on that.

Unfortunately, the threshold for understanding how Scheme works in lilypond is 
rather high (or, at least it was for me).

As soon as a #() expression is found in a ly file, it is evaluated (this 
happens _while_ the file is parsed). So in this case, what you really want to 
store in a variable, is a _function_ which sets the option accordingly:
noPnC = #(def-music-function (parser location) (ly:set-option ...))

When \noPnC is found in the score, that function will be called, and the 
option will be set.

-- 
Erik




reply via email to

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