lilypond-user
[Top][All Lists]
Advanced

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

Re: mapping a markup-command across strings in lyricmode


From: David Kastrup
Subject: Re: mapping a markup-command across strings in lyricmode
Date: Tue, 03 Sep 2013 11:22:20 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Mark Polesky <address@hidden> writes:

> I wrote a markup command which takes a string and parses
> it to make a special markup.  I'm leaving out the details,
> but the input might look something like:
>
> \markup \foo #"abc123"
>
> I want to use this in a Lyrics context, but constantly
> retyping "\markup \foo #" is annoying and takes up a lot
> of space in my file:
>
> \lyricmode {
>   \markup \foo #"abc123" __ _
>   \markup \foo #"def456"
>   \markup \foo #"ghi789" __ _ _
> }
>
> Is there a way to simplify the user interface?  This would
> be ideal, but I'm open to other suggestions:
>
> \lyricmode \mapFoo {
>   "abc123" __ _ "def456" "ghi789" __ _ _
> }

Try \mapFoo \lyricmode { ... } instead, making \mapFoo a music
function.  You then iterate through the music using something like

mapFoo =
#(define-music-function (parser location music) (ly:music?)
  (for-each
    (lambda (m)
      (set! (ly:music-property m 'text)
            #{ \markup \foo $(ly:music-property m 'text) #}))
    (extract-typed-music music 'lyric-text)))

-- 
David Kastrup




reply via email to

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