lilypond-user
[Top][All Lists]
Advanced

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

Re: Detecting null markup in Scheme


From: David Kastrup
Subject: Re: Detecting null markup in Scheme
Date: Mon, 04 Sep 2017 18:03:21 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Graham King <address@hidden> writes:

> On Fri, 2017-09-01 at 20:35 +0200, David Kastrup wrote: 
>> Graham King <address@hidden> writes:
>> 
>> > On Fri, 2017-09-01 at 19:06 +0200, David Kastrup wrote:
>> >> 
>> >> I'd just try (equal? markupContents "") here.  equal? can compare any
>> >> objects for "equality", and at least "" as input should compare equal
>> >> then.
>> >> 
>> > thanks David.  I'm getting "Missing or extra expression in (if (equal?
>> > markupContents ""))"
>> 
>> Well, missing.  You have a condition but no expression to be evaluated
>> depending on it.
>> 
> Thanks again David.  After a long struggle, I've got somewhere.  The 
> result is probably inelegant enough to cause some sucking of teeth 
> among the congnoscenti, but it works for me:
>
> ( if ( equal? #{ \markup #markupContents #}
>                   #{ \markup { \concat { "" "" "" } } #} )

Ouch.  I've forgotten that markups are just assembled when you write
them and are only interpreted when using interpret-markup .  Only then
does \markup \line { \concat { "" "" "" } } collapse to an empty
stencil.  So you probably had to mimic the contents of markupContents in
order to get equal? to do something reasonable.

Sorry for that.

>           #{ <> #}
>           (case whereMarkup
>              ((system) #{ \mark #markupContents #})
>              ((staff)  #{ <>^   #markupContents #})
>              (else     #{ \mark \markup \color #red #markupContents #})
>     ))

-- 
David Kastrup



reply via email to

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