[Top][All Lists]

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

Re: Creating markup macros (functions actually)

From: Paul Scott
Subject: Re: Creating markup macros (functions actually)
Date: Sat, 27 Nov 2004 12:25:56 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.7.3) Gecko/20041007 Debian/1.7.3-5

Nicolas Sceaux wrote:

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)))))


(lambda ...) evaluates to a function,

That I understand.

where you want a markup.
That I don't yet. Another look at new-markup-scm tells me a markup is a list?

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.

How do I display it in Scheme? I see you answer that below but it breaks right now.

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
That's a little complicated at the moment but I'm getting there.

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

I get:
address@hidden:~/music/test$ lilypond-snapshot
GNU LilyPond 2.4.2
Processing `'
In unknown file:
  ?: 0* [primitive-load "music-display.scm"]

<unnamed port>: In procedure open-file in expression (primitive-load name):
<unnamed port>: No such file or directory: "music-display.scm"

(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
                                      (markup #:simple "1")))))))
That will help a lot.

See scm/new-markups.scm.
This is beginning to make sense but I still have a way to go.

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.
should have links to tutorials and books.
Duh! I was there several times and missed the one link I needed which took me to:

Thanks so much for all your help and patience. I have been programming for many years in many languages but have only looked at scheme and lisp recently.


reply via email to

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