lilypond-devel
[Top][All Lists]
Advanced

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

Re: Cues (CueVoice) and quoted instrument name : InstrumentSwitch


From: Keith OHara
Subject: Re: Cues (CueVoice) and quoted instrument name : InstrumentSwitch
Date: Mon, 10 Oct 2011 23:20:56 -0700
User-agent: Opera Mail/11.51 (Win32)

 so it can take *optional* arguments,
I have not yet learned to use David's new facility for optional arguments...

Please report the parts of the documentation you find hard to
understand.  Optional arguments are quite easy to use: if reading the
documentation gives you a headache, there is something wrong with it.

The new docs are clear, mostly it took me some time to re-learn everything in 
"Extending" up to your addition.  (I have done no extending myself beyond 
adapting other people's Lisp-in-Lilypond.)

It would be good to warn people that optional arguments must come immediately before an 
argument that will be read in LilyPond syntax, so that the parser knows which argument is 
missing.  In the example below, the 'clef' argument can be left out, but if we leave out 
the 'name' then the parser tries to use UP for the name and "alto" for the 
direction.

bach =
#(define-music-function
    (parser location name dir clef music)
    ((string? "") ly:dir? (string?) ly:music?)
    (if clef
     #{
         \once \override TextScript #'direction = $dir
         s1*0-\markup { \tiny $name }
         \cueClef $clef
         $music
         \cueClefUnset
     #}
     #{
         \once \override TextScript #'direction = $dir
         s1*0-\markup { \tiny $name }
         $music
     #}
   ))

\relative c' {
   \bach #"name" #UP #"alto" {c d e f}
}





reply via email to

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