lilypond-user
[Top][All Lists]
Advanced

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

Re: How to get a property override into a scheme markup function?


From: Carl Sorensen
Subject: Re: How to get a property override into a scheme markup function?
Date: Tue, 21 Sep 2010 21:29:42 -0600



On 9/21/10 7:28 PM, "Jeff Epstein" <address@hidden> wrote:

> 
> I'm not sure what I'm missing here. Is there a translation between an ly
> property and scheme? "box-padding" does exist in the Internal Reference
> manual,
> and I've not yet found anything in the other manuals, nor in this forum
> (searching for scheme property override), that strike me as relevant.
> 
> If anyone could point me in the right direction, I would appreciate it.
> Thanks.
> 
Excellent question.  Thanks for sharing enough that we could answer it well.

You're doing everything right!  But the \displayMusic function missed a
quote that you need in your argument list--note that it should be
#:override '(box-padding . 0.5)   not
#:override (box-padding . 0.5)
:


%%%%%

#(define-markup-command  (mBox layout props s_boxText)
                                               (string?)
   "Print the given string in a box and small-caps. Example usage:
c4.^\\markup \\mBox \"section a\""

   (interpret-markup layout props
     (markup #:center-align #:override '(box-padding . 0.5) #:box #:caps
s_boxText)))


\relative c' {
  c1^\markup \mBox #"Section a"
}

%%%%%

The purpose of the initial ' is to prevent Scheme from trying to evaluate
the expression inside the parentheses.  Since the ' was missing, it tried to
evaluate box-padding, but box-padding hasn't been defined as a Scheme
variable.  It's just a scheme symbol (which is different).

By putting the ' before (box-padding . 0.5) we accept this as a cons cell
that will be added onto the property alist.

We get so used to prefacing alists with ' that we automatically put them
there in our minds.  I don't know why \displayMusic *didn't* put the quote
there, but the fact that it didn't is a bug.

Could you please file a simple bug report at address@hidden

Thanks,

Carl




reply via email to

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