[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: \include inside function
From: |
David Kastrup |
Subject: |
Re: \include inside function |
Date: |
Tue, 01 Feb 2022 17:33:13 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Leo Correia de Verdier <leo.correia.de.verdier@gmail.com> writes:
> Dear list!
>
> Is there a way to have an \include inside a function?
> In the attached file includeinfunction.ly the commented out line
> doesn’t work (probably for some very logical reason, but still unknown
> to me).
Uh, if you write the content of the included file _exactly_ where
\include #filename now is, you get _exactly_ the same error. Your
inclusion works perfectly fine. It's just that the syntax in the file
is not valid syntax inside of #{ ... #}.
If you want to include the file instead at the _top_ level, try
includeFunction = #(define-void-function (filename) (string?)
(ly:parser-include-string (format "\\include ~s"
filename)))
However, depending on the context you use this in, you might get
surprised by just _when_ the inclusion happens.
> Is there a way to work around that and have includes inside functions?
>
> (The function in this case is indeed meaningless, in my real use case
> the function will hopefully construct midi files from the variables in
> the included files combined in different ways)
>
> Thanks a lot!
>
> /Leo
>
> \version "2.23.3"
>
> includeFunction = #(define-void-function (filename) (string?)
> #{ \include #filename #} )
>
> \include "includetest.ily"
>
> % \includeFunction "includetest.ily"
>
> \score { \music }
>
>
--
David Kastrup
- \include inside function, Leo Correia de Verdier, 2022/02/01
- Re: \include inside function,
David Kastrup <=
- Re: \include inside function, Valentin Petzel, 2022/02/01
- Re: \include inside function, David Kastrup, 2022/02/01
- Re: \include inside function, Valentin Petzel, 2022/02/01
- Re: \include inside function, David Kastrup, 2022/02/01
- Re: \include inside function, Valentin Petzel, 2022/02/01
- Re: \include inside function, David Kastrup, 2022/02/01
- Re: \include inside function, Valentin Petzel, 2022/02/01
- Re: \include inside function, David Kastrup, 2022/02/01
- Re: \include inside function, Valentin Petzel, 2022/02/01
- Re: \include inside function, David Kastrup, 2022/02/01