From 36397a030af4845ae75b7958550a9e3f5069465e Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Tue, 24 Sep 2013 11:30:12 +0200 Subject: [PATCH] Issue 3579: Make "Adding extra fingering with scheme" snippet do something useful This snippet was never operative in 2.16 due to the EventChord changes of issue 2240. This updates it into using a few 2.16 features in order to make things simpler while retaining the basic purpose. --- .../new/adding-extra-fingering-with-scheme.ly | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Documentation/snippets/new/adding-extra-fingering-with-scheme.ly diff --git a/Documentation/snippets/new/adding-extra-fingering-with-scheme.ly b/Documentation/snippets/new/adding-extra-fingering-with-scheme.ly new file mode 100644 index 0000000000..b4d32ff1ea --- /dev/null +++ b/Documentation/snippets/new/adding-extra-fingering-with-scheme.ly @@ -0,0 +1,39 @@ +\version "2.16.0" + +\header { + lsrtags = "scheme-language" + + texidoc = " +You can add additional elements to notes using @code{map-some-music}. In this +example, an extra script is attached to a note. + +In general, first do a @code{\\displayMusic} of the music you want to +create, then write a function that will work on the appropriate parts +of the music for you. +" + doctitle = "Adding extra fingering with scheme" +} + +addScript = +#(define-music-function (parser location script music) + (ly:event? ly:music?) + (map-some-music + (lambda (mus) + (define (append-script-at! prop) + (set! (ly:music-property mus prop) + (append (ly:music-property mus prop) + (list (ly:music-deep-copy script)))) + mus) + (case (ly:music-property mus 'name) + ((EventChord) + (append-script-at! 'elements)) + ((NoteEvent) + (append-script-at! 'articulations)) + (else #f))) + music)) + +\score { + { + \addScript _6 { c'4-3 } + } +} -- 2.39.2