lilypond-devel
[Top][All Lists]
Advanced

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

Re: music function to be included somewhere in scm/*


From: David Nalesnik
Subject: Re: music function to be included somewhere in scm/*
Date: Wed, 14 Dec 2016 08:03:38 -0600

Hi Knut,

On Wed, Dec 14, 2016 at 3:16 AM, Knut Petersen
<address@hidden> wrote:
> Hi everybody!
>
> There is a discussion on lilypond-user with the target to allow automated
> lyric extenders
> to lilypond. One part of that is a patch to clean and extend
> lyric_extender.cc.
>
> To allow automated creation of lyric extenders a helper function is needed.
> Putting the
> following code into a lilypond score does the job:
>
> #(define autoextenders (define-music-function (lyrics) (ly:music?)
>    (music-map
>      (lambda (event)
>        (if (and (eq? (ly:music-property event 'name) 'LyricEvent)
>           (not (let* ((art (ly:music-property event 'articulations))
>                       (is-hyphen? (lambda (ev) (eq? (ly:music-property ev
> 'name) 'HyphenEvent))))
>                (find is-hyphen? art)))
>           (not (string=? (ly:music-property event 'text) " ")))
>           (ly:music-set-property! event 'articulations
>              (append (ly:music-property event 'articulations) (list
> (make-music (quote ExtenderEvent))))) event )
>      event)
>    lyrics)))
>
> Q1: Where should a definition of \autoextenders reside?
> scm/music-functions.scm?
>

The right place to define a music function is in
ly/music-functions-init.ly.  Supporting Scheme functions might go in
scm/music-functions.scm.

David



reply via email to

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