Hi,
conditional include is possible with ly:parser-include-string
https://github.com/igneus/lilygabc/blob/72c351a8032149013c3341335c1abc6e175a8b69/bin/rendergabc.ly#L18

Regards,
Jakub

On Tue, 7 Jul 2026, 08:39 Michael Scheer, <[email protected]> wrote:

> Hi Lilypond users,
>
> I want to have a complete include conditional. I cannot do:
>
> #(if (eq conditionvar #t) #{ \include "file.ily" #} )
>
> ...because errors. I think the include is replaced before the code is
> interpreted.
>
> So what I want to try then is, make the whole contents of the include file
> conditional. But I fail, it complains it is not music. What I tried is this
> (also tried "$(if"):
>
> #(if (eq conditionvar #t)
> #{
>   % The original include code begin
>   \header { instrument = "Klarinette 1" }
>   SomeVar = "Yo Bro Whassup"
>   ClarinetI = {
>     \transposition h
>     \key g \major \time 4/4
>     c4 4 e e
>   }
>   % The original include code end
> #}
> )
>
> Best regards
> Michael
>
>

Reply via email to