lilypond-devel
[Top][All Lists]
Advanced

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

Syntax-question about nested functions/procedures


From: Thomas Morley
Subject: Syntax-question about nested functions/procedures
Date: Wed, 1 Aug 2012 00:26:37 +0200

Hi,

fiddling around with a new patch for issue 2646 I tried to integrate
default-parenthesize into another function.
The following returns an error when uncommenting \override
Score.ParenthesesItem #'font-size = #0 and applying it to an
articulation.

\version "2.15.42"

parenthesizeII =
#(define-music-function (parser location mus) (ly:music?)

(define (proc arg)
;; from music-functions-init.ly
    (if (memq 'event-chord (ly:music-property arg 'types))
       ;; arg is an EventChord -> set the parenthesize property
       ;; on all child notes and rests
       (for-each
        (lambda (ev)
          (if (or (memq 'note-event (ly:music-property ev 'types))
                  (memq 'rest-event (ly:music-property ev 'types)))
              (set! (ly:music-property ev 'parenthesize) #t)))
        (ly:music-property arg 'elements))
       ;; No chord, simply set property for this expression:
       (set! (ly:music-property arg 'parenthesize) #t))
   arg)
#{

        %\override Score.ParenthesesItem #'font-size = #0
        $(proc mus)
#})

\relative c' {
        % works
        \parenthesizeII a'4-1

        % returns an error when uncommenting the
        % font-size-override above
        a4-\parenthesizeII-1
}

What's wrong and how to do it better?


-Harm



reply via email to

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