Hi Dominic,
On Mon, Oct 27, 2014 at 12:50 PM, Dominic <[email protected]> wrote:
> I am a little closer to my goal. I have come up with the following music
> function:
>
> /glissIndexPadHack =
> #(define-music-function
> (parser location index additionalpad normalpad)
> (number? number? number?)
> #{
> \once \override Glissando.bound-details =
> #(lambda (grob) (if (eq? (ly:grob-property grob
> 'glissando-index) #'index)
> '(
> (right (attach-dir . -1)
>
> (end-on-accidental . #t)
> (padding .
> 0.5))
> (left (attach-dir . 1)
> (padding .
> *#'additionalpad*))
> )
> '(
> (right (attach-dir . -1)
>
> (end-on-accidental . #t)
> (padding .
> 0.5))
> (left (attach-dir . 1)
> (padding .
> *#'normalpad*))
> )
> ))
> #})/
>
> Just one snag! If I replace the variables in bold (above) with literal
> values, e.g. 3 and 2, the code compiles and functions perfectly. But if I
> compile it as shown above, it seems like my variables are not being
> interpreted correctly. So I guess I must have made a syntactical error -
> wrong combination of # ' $ characters, perhaps? I tried various
> combinations
> of these characters, and some of them cause the compile to fail, some allow
> it to compile, but none allows it to function.
>
> What is the proper way to achieve this? Basically, I want to have
> individual
> control over the bound-details.left.padding values of glissando lines
> within
> a single chord.
>
> Thanks for any help!
>
> (I am using Lilypond 2.19.15)
>
>
You have to use "quasiquoting" to insert the evaluated variables into your
literal lists.
See
http://www.gnu.org/software/guile/docs/docs-1.8/guile-ref/Expression-Syntax.html#index-quasiquote-2199
.
(Note the backquote--easy to mistake for an apostrophe!)
\version "2.19.15"
glissIndexPadHack =
#(define-music-function
(parser location index additionalpad normalpad)
(number? number? number?)
#{
\once \override Glissando.bound-details =
#(lambda (grob) (if (eq? (ly:grob-property grob
'glissando-index) index)
`(
(right (attach-dir . -1)
(end-on-accidental . #t)
(padding . 0.5))
(left (attach-dir . 1)
(padding . ,additionalpad))
)
`(
(right (attach-dir . -1)
(end-on-accidental . #t)
(padding . 0.5))
(left (attach-dir . 1)
(padding . ,normalpad))
)
))
#})
{
\glissIndexPadHack 0 2 1 <aes'' ges f d>2. \glissando <f d cis b>4
}
%%%%%%%%
Best,
David
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user