lilypond-user
[Top][All Lists]
Advanced

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

Re: Creating markup macros (functions actually)


From: Nicolas Sceaux
Subject: Re: Creating markup macros (functions actually)
Date: Sat, 27 Nov 2004 16:21:13 +0100
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Paul Scott <address@hidden> writes:

> Does this make any sense?
>
> #(def-markup-command (testOne layout props) ()
>   (interpret-markup layout props
>    (markup #:number
>     (lambda (x) (ly:music-property x 'numerator)))))

No.

(lambda ...) evaluates to a function, where you want a
markup. Remember that the \number markup command takes a markup as an
argument, not a procedure.

When you want to parametrize (uh) a LilyPond expression, the first
thing to do is to write it, in plain LilyPond syntax, and then display
it in Scheme. Then you will have a pattern to use in your function
body. (What you want is a music function, not a markup command).

for instance, supposing that `mus:display' (see
http://lists.gnu.org/archive/html/lilypond-devel/2004-11/msg00029.html)
is defined in music-display.scm:

-----test.ly-----
#(load "music-display.scm")
#(mus:display #{ R1^\markup \number 1 #})
-----test.ly-----

lilypond test.ly
==>
(make-music 'SequentialMusic
  'elements (list
             (make-music 'MultiMeasureRestMusicGroup
               'elements (list
                          (make-music 'BarCheck)
                          (make-music 'EventChord
                            'elements (list
                                       (make-music 'MultiMeasureRestEvent
                                         'duration (ly:make-duration 0 0 1 1))))
                          (make-music 'BarCheck)
                          (make-music 'TextScriptEvent
                            'direction 1
                            'text (list
                                       number-markup
                                       (markup #:simple "1")))))))


>>See scm/new-markups.scm.
>>
>>
> I'll keep reading this but I don't understand it yet.  Can you
> recommend any online reading to understand scheme better?

I don't know much about scheme community sites. www.schemers.org
should have links to tutorials and books.

nicolas





reply via email to

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