hi Marc

i think *no* has a special meaning here: it puts the default value to the opposite! in your case you define a variable *slur* with #f - and there is no variable *no-slur*.

so probably using another name for your variable will get the correct result.

hth
Eluze


Am 24.12.2011 09:13, schrieb Marc Hohl:
> cc'ing to -devel, perhaps it is a bug?

Am 24.12.2011 00:41, schrieb -Eluze:
hi

    Marc Hohl wrote:

    Hello list,

    I have some files with songs where I want to switch the slurs on
    and off.

    After searching the docs, I came up with this:

    optional-slurs.ly
    ==================

    \version "2.15.23"

    #(ly:add-option 'no-slurs #f
            "Whether to print a slur or not.")

    slurSwitch = #(define-music-function (parser location) ()
         (if (eq? #t (ly:get-option 'no-slurs))
             #{ \override Slur #'transparent = ##t #}
             #{#}))

    test = {
        \slurSwitch
        c2 ( d )
    }

    \score { \test }

    ==================

    If I call it with

>  lilypond optional-slurs.ly

    everything is fine; when I use

>  lilypind -d no-slurs optional-slurs.ly

    I get a warning that option 'no-slurs is
    undefined, and the slurs are still visible.

    Searching in the archives showed

http://lists.gnu.org/archive/html/lilypond-devel/2009-11/msg00135.html http://lists.gnu.org/archive/html/lilypond-devel/2008-02/msg00080.html

    with no apparent solution.

i am certainly not a scheme expert but from the Application Usage i can see the option -d expects a variable name and a value:

/-dvar=val/

Hi Eluze,

thanks for your answer!

The extending manual says, however,

http://lilypond.org/doc/v2.15/Documentation/extending/functions-without-arguments

that I can use -d var as a boolean switch, so either the manual is wrong or something
has changed in lilypond's externals.

if you invoke lilypond with *-dvar=#t yourFile.ly *you can take over this value e.g. as

slurSwitch = #(define-music-function (parser location) ()
     (if (eqv? #t (ly:get-option 'var))
         #{ \override Slur #'transparent = ##t #}
         #{ #})
         )
test = {
    \slurSwitch
    c2 ( d )
}
\score { \test }

Ok, this works indeed - but the error message abound the unknown variable var
persists even if I define the option via ly:add-option

So something seems to be wrong - is this a bug?

Thanks,

Marc

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

Reply via email to