lilypond-user
[Top][All Lists]
Advanced

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

Re: parameters in lyrics?


From: David Kastrup
Subject: Re: parameters in lyrics?
Date: Wed, 16 Dec 2015 16:45:00 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Graham King <address@hidden> writes:

>
>         143:9: In expression ((#<procedure embedded-lilypond #> parser "
>         \\openBracket #syllable " ...)):
>         
> /Users/grahamk/Documents/lilypond/music/testbed/lyric_markup_test2.ly:143:9: 
> Wrong type to apply: #<Prob: Music C++: Music((origin . #<location 
> /Users/grahamk/Documents/lilypond/music/testbed/lyric_markup_test2.ly:250:9>) 
> (duration . #<Duration 4 >) (text . [blind))((display-methods #<procedure #f 
> (lyric parser)>) (name . LyricEvent) (iterator-ctor . #<primitive-procedure 
> ly:rhythmic-music-iterator::constructor>) (types rhythmic-event lyric-event 
> event)) >
>         
>
>         \version "2.19.21"

[...]

>         %%% Bracketed underlay %%%
>         openBracket =
>         #(define-music-function (parser location syllable)(markup?)
>            #{
>              #(make-music
>                'LyricEvent
>                'text
>                (format "[~a" syllable)
>                'duration
>                (ly:make-duration 2))
>            #})

Well, #{ #(...) #} as the sole content of a music function is likely
easier expressed as (...) in the first place.  And the predicate
"markup?" for something which you'll put into a format call is a bit
optimistic.

Either use a string? predicate instead, or write
#{ \lyricmode { \markup \concat { [ #syllable } 4 } #}

which is sort of more readable than writing
'text #{ \markup \concat ... #}, another possibility to avoid format and
still be able to integrate arbitrary markup.

>         
>         %%% Decide what we want:
>         #(define lyricEditorialStyle
>             (if (defined? 'lyricEditorialStyle)
>                 lyricEditorialStyle
>                 "bracketed"))
>         
>         #(ly:message "lyricEditorialStyle: ~a" lyricEditorialStyle)
>         
>         editorial = 
>         #(define-music-function (parser location syllable)(markup?)
>            (cond 
>               ((string=? lyricEditorialStyle "italic")
>                 (#{ \italic #syllable #}))
>               ((string=? lyricEditorialStyle "bracketed")
>                 (#{ \openBracket #syllable #}))
>               (else (ly:message "invalid lyricEditorialStyle: ~a"
>         lyricEditorialStyle)))
>         )

Well, the problem is simple: you write (#{...#}) where you should just
be writing #{...#}, and #{...#} cannot take the place of a function in a
function call.

-- 
David Kastrup



reply via email to

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