From f414cbfa3953c3134fdacf8723283067c5ca130a Mon Sep 17 00:00:00 2001
From: Han-Wen Nienhuys <hanwen@xs4all.nl>
Date: Thu, 28 Nov 2002 23:08:35 +0000
Subject: [PATCH] * input/regression/music-map.ly (texidoc): new file.

* scm/music-functions.scm (music-map): new function
---
 ChangeLog                     | 10 +++++++++
 input/regression/music-map.ly | 39 +++++++++++++++++++++++++++++++++++
 lily/ligature-engraver.cc     |  4 ++--
 scm/music-functions.scm       | 19 +++++++++++++++++
 4 files changed, 70 insertions(+), 2 deletions(-)
 create mode 100644 input/regression/music-map.ly

diff --git a/ChangeLog b/ChangeLog
index 5de30b28a6..9df46a4bbf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2002-11-29  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
+
+	* input/regression/music-map.ly (texidoc): new file.
+
+	* scm/music-functions.scm (music-map): new function
+
+2002-11-28  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
+
+	* lily/ligature-engraver.cc (create_ligature_spanner): fix fixes.
+
 2002-11-28  Heikki Junes <hjunes@cc.hut.fi>
 
 	* input/test/to-xml.ly:
diff --git a/input/regression/music-map.ly b/input/regression/music-map.ly
new file mode 100644
index 0000000000..b92b85386b
--- /dev/null
+++ b/input/regression/music-map.ly
@@ -0,0 +1,39 @@
+\header {
+
+texidoc =
+
+"With @code{music-map}, you can apply functions operating on a single
+piece of music to an entire music expression. In this example, the
+scripts and dynamics of the first measure of music are applied to the
+2nd measure. "
+
+}
+
+
+\version "1.7.8"
+
+#(define (notes-to-skip m)
+"Convert all stuff with duration (notes, lyrics, bass figures, etc.) to skips.
+Scripts and dynamics are maintained.
+"
+  (if (memq 'rhythmic-event (ly:get-mus-property m 'types))
+	(let* ((newmus 	  (make-music-by-name 'SkipEvent)))
+		(map
+		  (lambda (x) (ly:set-mus-property! newmus (car x) (cdr x)))
+		  (ly:get-mutable-properties m))
+		newmus
+	)
+	m)
+)
+
+
+foobar = \notes \transpose c c' { c4-\>-^ c4-^ c4-\!-^ c4-^  } 
+
+\score {
+  \notes \relative c''  \context Voice {
+	\foobar
+
+	< \apply #(lambda (x) (music-map x notes-to-skip))
+		\foobar
+	   { d2 d2 } > 
+}}
diff --git a/lily/ligature-engraver.cc b/lily/ligature-engraver.cc
index 6e282805d2..3344e363a6 100644
--- a/lily/ligature-engraver.cc
+++ b/lily/ligature-engraver.cc
@@ -64,7 +64,7 @@ Ligature_engraver::try_music (Music *m)
 Spanner *
 Ligature_engraver::create_ligature_spanner ()
 {
-  return new Spanner (SCM_EOL);
+  return 0;
 }
 
 void
@@ -185,7 +185,7 @@ Ligature_engraver::acknowledge_grob (Grob_info info)
 
 ENTER_DESCRIPTION (Ligature_engraver,
 /* descr */       "Abstract class; a concrete subclass handles Ligature_events by engraving Ligatures in a concrete style.",
-/* creats */      "Ligature_engraver",
+/* creats */      "",
 /* accepts */     "ligature-event abort-event",
 /* acks  */      "ligature-head-interface rest-interface",
 /* reads */       "",
diff --git a/scm/music-functions.scm b/scm/music-functions.scm
index 8fba5384cf..01e84057bf 100644
--- a/scm/music-functions.scm
+++ b/scm/music-functions.scm
@@ -10,6 +10,23 @@
 		 (number->string (ly:get-mus-property mus 'denominator))
 		 ))
 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(define-public (music-map music function)
+  "Apply @var{function} to @var{music} and all of the music it contains. "
+  (let* ((es (ly:get-mus-property music 'elements))
+         (e (ly:get-mus-property music 'element))
+	 )
+
+    (ly:set-mus-property! music 'elements 
+	(map (lambda (y) (music-map y function)) es))
+	(if (ly:music? e)
+	    (ly:set-mus-property! music 'element (music-map e function)))
+	(function music)
+	))
+
+
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
@@ -51,6 +68,8 @@
     music))
 
 
+
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; repeats.
 
-- 
2.39.5