lilypond-user
[Top][All Lists]
Advanced

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

Re: function that inserts a toplevel expression


From: David Kastrup
Subject: Re: function that inserts a toplevel expression
Date: Thu, 10 May 2012 12:05:03 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

Urs Liska <address@hidden> writes:

> So now the question:
> How can I write a function that produces a toplevel expression?

No such thing.

> I want to be able to write:
>
> \debugCurvesOn
>
> or
>
> #(debug-curves-on)
>
> (or something similar) which should then expand to
>
> \layout {
>   \context {
>     \Score
>     \override Slur #'stencil = #(display-control-points)
>     \override PhrasingSlur #'stencil = #(display-control-points)
> \override Tie #'stencil = #(display-control-points) }
> }
>
> (you see where this is going? ;-) )

debugCurvesOn = \layout {
   \context {
     \Score
     \override Slur #'stencil = #(display-control-points)
     \override PhrasingSlur #'stencil = #(display-control-points)
 \override Tie #'stencil = #(display-control-points) }
}

That created a layout definition (more accurately: an output definition
suitable for use in layouts).  Which can be used in \layout:

\layout { \debugCurvesOn  [Other stuff ...] }

If you want to turn this into a function, you use define-scheme-function
and construct the return value using #{ \layout { ... } #}.

> Furthermore I will later want to write functions for the \score block,
> and I will want to pass some parameters in there - which doesn't work
> with include files.

Not clear to me what you want.

-- 
David Kastrup




reply via email to

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