Janek Warchoł <janek.lilyp...@gmail.com> writes:

> % Hi people,
>
> % here's what i want to do:
>
> <<
>   {
>     \overrideProperty #"Score.NonMusicalPaperColumn"
>     #'line-break-system-details  #'((alignment-distances . (30)))
>     a a a a
>   }
>   { b b b b }
>>>
>
> % the override is very long, so i wanted to create a helper music
> function.  I tried this
>
> staffdist =
> #(define-music-function (parser location distances)
>                         (list?)
>                         #{
>                           \overrideProperty #"Score.NonMusicalPaperColumn"
>                           #'line-break-system-details
> #'((alignment-distances . #'distances))
>                         #})

> I don't see any example function operating on lists in the Extending
> manual, so i'm a bit lost.  I had no problem with a similar function
> which operates on a pair and overrides beam positions.  I have no idea
> why this doesn't work.
>
> what i'm doing wrong?

Quite a bit.

First, let's assume 2.16 (the current development version will not
accept the above syntax of \overrideProperty even in the first variant).

Then inside of # itself, like with #'((alignement-distances ..., # has
only Scheme meanings, like #t, #f, #(2 3 4) (a literal vector), #{
... #} (embedded LilyPond), #\? (a character constant).  #' is not
anything it recognizes I think.

Then you are writing a quoted list here.  Inside of a quoted list, _all_
symbols are quoted, not referenced for their value.  So you need either
to use proper evaluated Scheme here, like
#(list (cons 'alignment-distances distances))
or quasi-quoting (backtick at the start, evaluated stuff with , before
it), like
#`((alignment-distances . ,distances))
I am not entirely sure that . , is accepted, but if it isn't,
#`((alignment-distances ,@distances))
should do the trick instead (,@ is the list splicing operator, basically
stripping one level of parens when inserting).

-- 
David Kastrup


_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to