]> git.donarmstrong.com Git - lilypond.git/commitdiff
Add regtest for copy/modify semantics of make-relative macro
authorDavid Kastrup <dak@gnu.org>
Mon, 25 Nov 2013 11:17:03 +0000 (12:17 +0100)
committerDavid Kastrup <dak@gnu.org>
Sun, 1 Dec 2013 11:58:20 +0000 (12:58 +0100)
input/regression/make-relative-copies.ly [new file with mode: 0644]

diff --git a/input/regression/make-relative-copies.ly b/input/regression/make-relative-copies.ly
new file mode 100644 (file)
index 0000000..93c9fe9
--- /dev/null
@@ -0,0 +1,29 @@
+\header {
+  texidoc = "@code{make-relative} has to copy its argument expressions
+in case the generated music expression is getting copied and modified.
+
+The code here defines a @code{\\reltranspose} function working inside
+of @code{\\relative} and uses it.  Both staves should appear
+identical."
+}
+
+\layout {
+  ragged-right = ##t
+}
+
+reltranspose =
+#(define-music-function (parser location from to music)
+  (ly:pitch? ly:pitch? ly:music?)
+  (make-relative (music) music
+   #{ \transpose #from #to $music #}))
+
+mus =
+\reltranspose c g {
+  \partial 4. c8 e g |
+  c2 r8 c, e g c1 | \bar "|."
+}
+
+<<
+  \new Staff \relative \mus
+  \new Staff \relative \mus
+>>