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: Mon, 12 Jun 2017 08:22:50 -0700

On 2017/06/10 19:36:30, pwm wrote:

That's a nice consistency.  I tried it out and the following works
too:

#(define (onpage proc nmbr)
   (markup-when ((page:page-number -1))
    (proc page:page-number nmbr)))

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

Come to think of it, the only application would seem in connection with
\on-the-fly, so it should be possible to wrap the \on-the-fly invocation
into the macro as well.

I've put up issue 5145 for basically replacing \on-the-fly with $ when
one really wants to write this as \markup $(onpage > 3) "This is long!".

This requires an amended definition of markup-when adding a markup
command signature:

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

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

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

\score {
  \repeat unfold 256 c'1
}

I don't actually want to pursue this path as the preferred user
interface: it just seemed to me that it should work.

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



reply via email to

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