]> git.donarmstrong.com Git - lilypond.git/commitdiff
Run scripts/auxiliar/makelsr.py
authorDavid Kastrup <dak@gnu.org>
Tue, 24 Sep 2013 09:32:05 +0000 (11:32 +0200)
committerDavid Kastrup <dak@gnu.org>
Tue, 1 Oct 2013 05:50:08 +0000 (07:50 +0200)
Documentation/snippets/adding-extra-fingering-with-scheme.ly

index 2fe4bcd6c44f0807f890996531197cc2e1066c8f..9e3f6072cb2ecd4d76d3872724b72bd31075a4cf 100644 (file)
@@ -1,53 +1,47 @@
-%% DO NOT EDIT this file manually; it is automatically
-%% generated from LSR http://lsr.dsi.unimi.it
-%% Make any changes in LSR itself, or in Documentation/snippets/new/ ,
-%% and then run scripts/auxiliar/makelsr.py
-%%
-%% This file is in the public domain.
+% DO NOT EDIT this file manually; it is automatically
+% generated from Documentation/snippets/new
+% Make any changes in Documentation/snippets/new/
+% and then run scripts/auxiliar/makelsr.py
+%
+% This file is in the public domain.
+%% Note: this file works from version 2.16.0
 \version "2.16.0"
 
 \header {
   lsrtags = "scheme-language"
 
   texidoc = "
-You can add various stuff to notes using @code{make-music}. In this
-example, an extra fingering is attached to a note.
-
-
-In general, first do a @code{display} of the music you want to create,
-then write a function that will structure the music for you.
-
-
+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"
 } % begin verbatim
 
 
-#(define (make-text-script x)
-   (make-music 'TextScriptEvent
-               'direction DOWN
-               'text (make-simple-markup x)))
-
-#(define (add-text-script m x)
-   (if (equal? (ly:music-property m 'name) 'EventChord)
-       (set! (ly:music-property m 'elements)
-             (cons (make-text-script x)
-                  (ly:music-property m 'elements)))
-       (let ((es (ly:music-property m 'elements))
-            (e (ly:music-property m 'element)))
-        (map (lambda (y) (add-text-script y x)) es)
-        (if (ly:music? e)
-            (add-text-script e x))))
-   m)
-
 addScript =
-#(define-music-function (parser location script music )
-                                       ( string? ly:music? )
-               (add-text-script music script))
+#(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 }
+    \addScript _6 { c'4-3 <c' e' g'> }
   }
 }