lilypond-devel
[Top][All Lists]
Advanced

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

Re: Add on-page-greater-than, -less-than (on-the-fly) (issue 74540044)


From: dak
Subject: Re: Add on-page-greater-than, -less-than (on-the-fly) (issue 74540044)
Date: Fri, 09 Jun 2017 06:36:52 -0700

Ok, I've taken another look at something that should help with this
amount of fine-grained definitions.  Do you think that the following
macro markup-when would be fine-grained enough to forego these kind of
definition?  I demonstrate it for implementing on-page-greater-than but
of course one may use it directly.  Its first argument is of the same
style as the #:properties keyword arg for define-markup-command .

#(define-macro (markup-when properties cond)
  `(lambda (layout props arg)
    (let ,(map (lambda (p)
                (if (pair? p)
                 `(,(car p) (chain-assoc-get ',(car p) props ,@(cdr p)))
                 `(,p (chain-assoc-get ',p props))))
           properties)
     (if ,cond (interpret-markup layout props arg)
      empty-stencil))))

#(define (on-page-greater-than nmbr)
  (markup-when ((page:page-number -1))
   (> page:page-number nmbr)))

\paper {
  #(set-paper-size "a7landscape")
  oddFooterMarkup = \markup \on-the-fly #(on-page-greater-than 3) "This
is long!"
}

\score {
  \repeat unfold 256 c'1
}


https://codereview.appspot.com/74540044/



reply via email to

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