lilypond-user
[Top][All Lists]
Advanced

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

Re: Variable weirdness


From: Jan-Peter Voigt
Subject: Re: Variable weirdness
Date: Tue, 8 Nov 2016 07:44:15 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0

Hello,

here is a demo of the code:

%%% snip
\version "2.19.49"

% the 2.18 version would just use parser and layout in the signature and the additional parser-argument in the ly:parser-define! call
parserDefine =
#(define-scheme-function (vkey val)(symbol? scheme?)
   (ly:parser-define! vkey val))

%%%% Demo

\parserDefine music \relative c'' { c b bes a }

{ \music }
%%% /snip

HTH
Jan-Peter

Am 08.11.2016 um 07:06 schrieb Jan-Peter Voigt:
Hello,

in these situations I use a little scheme-function like this:

parserDefine =
#(define-scheme-function (key val)(symbol? scheme?)
(ly:parser-define! key val))

!!!(I will correct this later, when I am on real computer ....)

This scheme-function works on every level defining a variable into the current parser.

HTH
Jan-Peter

Am 7. November 2016 23:55:00 MEZ, schrieb Simon Albrecht <address@hidden>:

    On 07.11.2016 17:56, David Kastrup wrote:

        David Sumbler <address@hidden> writes:

            I had the following lines in the main file of my current
            Lilypond project: \book { \bookOutputName "../firstCello"
            partName = "Cello 1" \include "frontcover.ily" \bookpart {
            %music... The file "frontcover.ily" contains a \bookpart
            block which prints a front cover with title, composer etc.
            - these are defined elsewhere. But it needs one more
            variable, viz. 'partName'. I discovered that Lilypond will
            not accept a variable definition in Lilypond format in the
            position I have put it: at the top level of a \book block.
            Nor will it accept it in a \bookpart block. But at a
            higher or a lower level, it will. This seems a bit weird
            (to say the least), in view of the fact that by replacing
            the line partName = "Cello 1" with the Scheme form
            #(define partName "Cello 1") everything works as intended.
            Is there any useful reason why a variable cannot be
defined in Lilypond format in these contexts? Because they would not be local to these contexts?

    In other words, to make this work, books and bookparts would need their
    own namespaces, am I right? What would be the drawbacks of that? I
    daresay it would be pretty intuitive to use, and I’ve also found myself
    wanting that feature in the past, mainly to simplify \include structures.

    Best, Simon

    ------------------------------------------------------------------------

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

-- Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.

_______________________________________________
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]