Thank. well that got me a step farther.  However now I see that this works
without curly braces around the \markup...Examples below.  I'm not that
familiar with guile so it's probably related to how variables work in
guile. The end goal is to have a fair amount of template stuff in the
function with some variables passed in to fill in some gaps.
\version "2.24.4"

hdr =
#(define-scheme-function (name) (string?)
   #{
     \header {
     title = \markup #name
     }
   #})
\hdr "test"
%\header { title = test }
\score {
{c4 d e f}
}

This throws an error.
hdr =
#(define-scheme-function (name) (string?)
   #{
     \header {
     title = \markup {#name}
     }
   #})

\hdr "test"

%\header { title = test }

\score {
{c4 d e f}
}

Guile signaled an error for the expression beginning here

title = \markup {#

name}


Unbound variable: #{name\x7d;}#

C:/Users/waltn/AppData/Local/Temp/frescobaldi-hg83vfc9/tmpix0jvon3/document.ly:8:7
<1>: error: syntax error, unexpected end of input

}

On Tue, Oct 1, 2024 at 2:23 PM Timothy Lanfear <timo...@lanfear.me> wrote:

> On 01/10/2024 22:06, Walt North wrote:
>
> I may be thinking about define-void-function incorrectly.  Here is a
> trimmed down example of what I was trying to do.  I want to have a callable
> function that sets up my \header.
>
> There are other ways I could go about this to get what I want - but I
> originally thought this would be easy way to go and put the function in an
> include file. And if I can get this to work there are some things I could
> use the same type of approach on.
>
> Here is the trimmed down same.  It does not produce any heading.
>
>
> Walt North
>
>
> \version "2.24.4"
>
> hdr =
> #(define-void-function (name) (string?)
>    #{
>      \header {
>      title = #name
>      }
>    #})
>
> \hdr "test"
>
> %\header { title = test }
>
> \score {
> {c4 d e f}
> }
>
> Replace define-void-function with define-scheme-function and things will
> work. The function then returns the scheme code for your header and inserts
> it in your LilyPond file.
>
> --
> Timothy Lanfear, Bristol, UK.
>
>

Reply via email to