]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4495 Remove unnecessary #{ .. #} constructs from satb template
authorTrevor Daniels <t.daniels@treda.co.uk>
Sun, 19 Jul 2015 18:15:42 +0000 (19:15 +0100)
committerTrevor Daniels <t.daniels@treda.co.uk>
Fri, 24 Jul 2015 08:25:30 +0000 (09:25 +0100)
Either because they were never needed or because the resolution
of Issue 4421 (Make music functions callable from Scheme) now
permits their removal.

Note: not all such constructs have been removed, even though their
removal is possible, since in these cases removal would reduce clarity.

Also tidy up conditional clauses.

ly/satb.ly
ly/staff-tkit.ly
ly/vocal-tkit.ly

index 2a7e9adb0abc8d66604d47999225718d16c59ae8..36e9dc367af947fd8b92be3cbd42ac750adb9b7d 100644 (file)
@@ -177,7 +177,7 @@ Piano = \make-pianostaff
   #(if have-music
        #{ << \SATB \Piano >> #}
        #{ { } #} )
-  \layout { $(if Layout #{ \Layout #} ) }
+  \layout { $(if Layout Layout) }
 }
 
 
index 2902208bff8bad2f63e412a579e9a162cd0dba2c..9c1c575c173a8fbd98431fd4e6219b2f04e52565 100644 (file)
@@ -39,32 +39,26 @@ make-one-voice-staff =
        \with {
          instrumentName = \markup \smallCaps {
            #(if show-instrName
-                (if instrName
-                     #{ #instrName #}
-                     #{ #name #} )
-                #{ "" #} )
+                (if instrName instrName name)
+                "")
          }
          shortInstrumentName = \markup \smallCaps {
            #(if show-instrName
-                (if shortInstrName
-                     #{ #shortInstrName #}
-                     (if instrName
-                         #{ #(substring instrName 0 1) #}
-                         #{ #(substring name 0 1) #} ))
-                     #{ "" #} )
+                (cond
+                 (shortInstrName shortInstrName)
+                 (instrName (substring instrName 0 1))
+                 (else (substring name 0 1)))
+                "")
          }
-         midiInstrument =
-           #(if midiName
-                #{ #midiName #}
-                #{ "clarinet" #} )
-         #(if dynUp
-              #{ \dynamicUp #}
-              (if dynDown
-                  #{ \dynamicDown #}
-                  #{ \dynamicNeutral #} ))
+         midiInstrument = #(if midiName midiName "clarinet")
+         #(cond
+           (dynUp dynamicUp)
+           (dynDown dynamicDown)
+           (else dynamicNeutral))
+
        }
        {
-         #(if Key #{ \Key #} )
+         #(if Key Key)
          \clef #clef
          \make-voice #name
        }
@@ -103,36 +97,32 @@ make-two-voice-staff =
                  #{ \markup \smallCaps #instrName #}
                  #{ \markup \right-column \smallCaps {
                   #(if v1music
-                       (if v1InstrName
-                           v1InstrName
-                           v1name)
+                       (if v1InstrName v1InstrName v1name)
                        "")
                   #(if v2music
-                       (if v2InstrName
-                           v2InstrName
-                           v2name)
-                       "") } #} )
+                       (if v2InstrName v2InstrName v2name)
+                       "")
+                 } #} )
              shortInstrumentName =
                #(if shortInstrName
                   #{ \markup \smallCaps #shortInstrName #}
                   #{ \markup \right-column \smallCaps {
                     #(if v1music
-                         (if v1ShortInstrName
-                             v1ShortInstrName
-                             (if v1InstrName
-                                 (substring v1InstrName 0 1)
-                                 (substring v1name 0 1)))
+                         (cond
+                          (v1ShortInstrName v1ShortInstrName)
+                          (v1InstrName (substring v1InstrName 0 1))
+                          (else (substring v1name 0 1)))
                          "")
                     #(if v2music
-                         (if v2ShortInstrName
-                             v2ShortInstrName
-                             (if v2InstrName
-                                 (substring v2InstrName 0 1)
-                                 (substring v2name 0 1)))
-                         "") } #} )
+                         (cond
+                          (v2ShortInstrName v2ShortInstrName)
+                          (v2InstrName (substring v2InstrName 0 1))
+                          (else (substring v2name 0 1)))
+                         "")
+                  } #} )
            }
            <<
-             #(if Key #{ \Key #} )
+             #(if Key Key)
              \clef #clef
 
              #(if v1music
@@ -142,14 +132,12 @@ make-two-voice-staff =
                    \consists "Staff_performer"
                    \dynamicUp
                    midiInstrument =
-                     #(if v1midiName
-                          #{ #v1midiName #}
-                          #{ "clarinet" #})
+                     #(if v1midiName v1midiName "clarinet")
                  }
                  <<
-                   #(if KeepAlive #{ \KeepAlive #} )
-                   #(if Time #{ \Time #} )
-                   #(if v2music #{ \voiceOne #} #{ \oneVoice #} )
+                   #(if KeepAlive KeepAlive)
+                   #(if Time Time)
+                   #(if v2music voiceOne oneVoice)
                    #v1music
                  >>
                #} )
@@ -161,14 +149,12 @@ make-two-voice-staff =
                    \consists "Staff_performer"
                    \dynamicDown
                    midiInstrument =
-                     #(if v2midiName
-                          #{ #v2midiName #}
-                          #{ "clarinet" #})
+                     #(if v2midiName v2midiName "clarinet")
                  }
                  <<
-                   #(if KeepAlive #{ \KeepAlive #} )
-                   #(if Time #{ \Time #} )
-                   #(if v1music #{ \voiceTwo #} #{ \oneVoice #} )
+                   #(if KeepAlive KeepAlive)
+                   #(if Time Time)
+                   #(if v1music voiceTwo oneVoice)
                    #v2music
                  >>
                #} )
index b82f56919cac4211a71b01205767e3972edd4704..5490005283277b99399025c2fa895cc411821d5e 100644 (file)
@@ -7,54 +7,52 @@ make-one-voice-vocal-staff =
 #(define-music-function (name clef)
    (voice-prefix? string?)
 
-   "Make a staff with one voice and lyrics beneath
-     name: the default prefix for instrument name and music
-     clef: the clef for this staff "
+  "Make a staff with one voice and lyrics beneath
+    name: the default prefix for instrument name and music
+    clef: the clef for this staff "
 
-   (if (make-id name "Music")
-     #{
-       <<
-         \make-one-voice-staff #name #clef "Up"
-         #(make-simultaneous-music
-           (reverse (map
-             (lambda (lyrics-postfix)
-               #{ \make-one-stanza "Below" #name #name #lyrics-postfix #} )
-               lyrics-postfixes)))
-       >>
-     #}
-     (make-music 'SequentialMusic 'void #t)))
+  (if (make-id name "Music")
+      (make-simultaneous-music
+       (list
+        (make-one-voice-staff name clef "Up")
+        (make-simultaneous-music
+          (reverse (map
+            (lambda (lyrics-postfix)
+              (make-one-stanza "Below" name name lyrics-postfix))
+              lyrics-postfixes)))))
+      (make-music 'SequentialMusic 'void #t)))
 
 make-two-voice-vocal-staff =
 #(define-music-function (name clef v1name v2name)
    (voice-prefix? string? voice-prefix? voice-prefix?)
 
-   "Make a vocal staff with two voices and lyrics above and below
-      name: the prefix to the staff name
-      clef: the clef to use
-    v1name: the prefix to the name of voice one
-    v2name: the prefix to the name of voice two "
+  "Make a vocal staff with two voices and lyrics above and below
+     name: the prefix to the staff name
+     clef: the clef to use
+   v1name: the prefix to the name of voice one
+   v2name: the prefix to the name of voice two "
 
-   (define v1music (make-id v1name "Music"))
-   (define v2music (make-id v2name "Music"))
+  (define v1music (make-id v1name "Music"))
+  (define v2music (make-id v2name "Music"))
 
-   #{
-     <<
-       \make-two-voice-staff #name #clef #v1name #v2name
-       #(if v1music
-           (make-simultaneous-music
-              (map
-               (lambda (lyrics-postfix)
-                 #{ \make-one-stanza "Above" #name #v1name #lyrics-postfix #} )
-               lyrics-postfixes)))
+  (make-simultaneous-music
+   (delq! #f
+    (list
+     (make-two-voice-staff name clef v1name v2name)
+     (and v1music
+          (make-simultaneous-music
+           (map
+            (lambda (lyrics-postfix)
+              (make-one-stanza "Above" name v1name lyrics-postfix))
+            lyrics-postfixes)))
 
-       #(if v2music
-            (make-simultaneous-music
-             (reverse (map
-              (lambda (lyrics-postfix)
-                 #{ \make-one-stanza "Below" #name #v2name #lyrics-postfix #} )
-               lyrics-postfixes))))
-     >>
-   #} )
+     (and v2music
+          (make-simultaneous-music
+           (reverse
+            (map
+             (lambda (lyrics-postfix)
+               (make-one-stanza "Below" name v2name lyrics-postfix))
+             lyrics-postfixes))))))))
 
 make-two-vocal-staves-with-stanzas =
 #(define-music-function
@@ -72,18 +70,16 @@ The number of stanzas is determined by the number of populated verse names.
      vxname: the prefix to the name of voice x, x = 1..4
      verses: the list of verse names containing the stanzas"
 
-    #{
-        <<
-          \make-two-voice-vocal-staff
-            #upperName #upperClef #v1name #v2name
-          #(make-simultaneous-music
-            (map
-             (lambda (verse-name)
-              #{ \make-one-stanza
-                   #upperName #v1name #v2name #verse-name #} )
-            verses))
-          \make-two-voice-vocal-staff
-            #lowerName #lowerClef #v3name #v4name
-        >>
-      #} )
+  (make-simultaneous-music
+   (list
+    (make-two-voice-vocal-staff
+     upperName upperClef v1name v2name)
+    (make-simultaneous-music
+     (map
+      (lambda (verse-name)
+        (make-one-stanza
+         upperName v1name v2name verse-name))
+        verses))
+    (make-two-voice-vocal-staff
+     lowerName lowerClef v3name v4name))))