lilypond-user
[Top][All Lists]
Advanced

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

Re: conditional include


From: David Kastrup
Subject: Re: conditional include
Date: Tue, 05 Feb 2013 11:07:35 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Jan-Peter Voigt <address@hidden> writes:

> Hi Urs,
>
> you can write a music-function that conditionally includes files.
> I use a function to include a file, if it exists. The if statement can
> of course also test for a option with ly:get-option.

> \version "2.16.0"
>
> includeIfExists =
> #(define-music-function (parser location file)(string?)
>    (if (file-exists? file)
>        (ly:parser-include-string parser (format "\\include \"~A\"\n" file)))
>    (make-music 'SequentialMusic 'void #t))

Any reason you don't use define-void-function here?  Saves the somewhat
weird make-music call and is likely usable in more places.

-- 
David Kastrup




reply via email to

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