lilypond-user
[Top][All Lists]
Advanced

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

Re: problems with user-defined command line options


From: -Eluze
Subject: Re: problems with user-defined command line options
Date: Fri, 23 Dec 2011 15:41:12 -0800 (PST)

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

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 }
i'd appreciate scheme experts to confirm this is how to use this option or to provide better examples!

thanks!
Eluze


View this message in context: Re: problems with user-defined command line options
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.

reply via email to

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