lilypond-user
[Top][All Lists]
Advanced

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

Re: Book and variables -- lost how to remedy


From: Simon Albrecht
Subject: Re: Book and variables -- lost how to remedy
Date: Fri, 11 Nov 2016 19:58:20 +0100

On 11.11.2016 19:41, Bernhard Kleine wrote:
I added this to testmain.ly before the \book
 parserDefine =
#(define-void-function (name val)(symbol? not-null?)
    (ly:parser-define! name val))
and got this error:

F:/Meine Noten/EigeneNoten/WeihnachtsLieder/testmain.ly:17:2 <0>: error: GUILE signaled an error for the expression beginning here

#

(define-void-function (name val)(symbol? not-null?)


Maybe some other requirement is missing.

Likely that requirement is a (more) recent version of LilyPond. One of your earlier attachments said \version "2.19.5", and that version required the function definition to begin with
#(define-void-function (parser location name val)(…)…)
The parser and location arguments can be omitted since somewhere in the 2.19 series.

Best, Simon


Bernhard

Am 11.11.2016 um 18:43 schrieb Jan-Peter Voigt:
Hello

there's one solution, I use in this cases:

parserDefine =
#(define-void-function (name val)(symbol? not-null?)
    (ly:parser-define! name val))

as parserDefine is a void function, you can all it anywhere - even inside a music expression:

\parserDefine global { ... }

instead of

global = { ... }

Of course, you might use a shorter name like just 'def' instead of parserDefine. But take care not to use a reserved name like 'define'.

HTH
Jan-Peter

Am 11.11.2016 um 17:15 schrieb Federico Bruni:
Il giorno ven 11 nov 2016 alle 16:45, Bernhard Kleine <address@hidden> ha scritto:
However when the global variable to the top of 2test.ly, the file could be compiled. I tried then the same on my full piece and I failed while parsing with F:/Meine Noten/EigeneNoten/WeihnachtsLieder/2test.ly:2:1: error: syntax error, unexpected STRING
global = {

To make this evident I include the files once more. I do not understand this.

I hit the same wall some time ago :)

If you read the first error message:

/tmp/2test.ly:2:1: error: syntax error, unexpected STRING

it points to the definition of global in the included file.

The problem here is that the variable is included (and evaluated) within a \bookpart block, but variables can be defined only at top level. That's why you need an extra file only for variables (the use of .ily extension is only a useful convention, as Urs already wrote).

I don't think that there's another way to achieve what you want.




_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user


_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user

--
spitzhalde9
D-79853 lenzkirch
address@hidden
www.b-kleine.com,www.urseetal.net
-
thunderbird mit enigmail
GPG schlüssel: D5257409
fingerprint:
08 B7 F8 70 22 7A FC C1 15 49 CA A6 C7 6F A0 2E D5 25 74 09


_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user




reply via email to

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