]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/music-functions.scm
(convert-to-ps): invoke dvips with -t
[lilypond.git] / scm / music-functions.scm
index 62832f29c3547a3f999cc3a1fde085e131ab1802..4f4152a2750c4b31c6ae7940796d95e47af8deab 100644 (file)
@@ -48,7 +48,7 @@
       (set! (ly:music-property music 'elements) filtered-es)
       (set! (ly:music-property music 'articulations) filtered-as)
       ;; if filtering emptied the expression, we remove it completely.
-      (if (or (pred? music)
+      (if (or (not (pred? music))
              (and (eq? filtered-es '()) (not (ly:music? e))
                   (or (not (eq? es '()))
                       (ly:music? e))))
       music
       (make-music 'Music)))      ;must return music.
 
-(define-public (remove-tag tag)
-  (lambda (mus)
-    (music-filter
-     (lambda (m)
-       (let* ((tags (ly:music-property m 'tags))
-             (res (memq tag tags)))
-        res))
-     mus)))
 
 (define-public (display-music music)
   "Display music, not done with music-map for clarity of presentation."
@@ -601,6 +593,27 @@ Syntax:
                           (lambda (,@args)
                             ,@body)))
 
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(define-public ((quote-substitute quote-tab) music)
+  (let*
+      ((quoted-name (ly:music-property music 'quoted-music-name))
+       (quoted-vector (if (string? quoted-name)
+                         (hash-ref quote-tab quoted-name #f)
+                         #f
+                         ))
+
+       )
+
+    (if (string? quoted-name)
+       (if  (vector? quoted-vector)
+            (set! (ly:music-property music 'quoted-events) quoted-vector)
+            (ly:warn "Cannot find quoted music `~S'" quoted-name)))
+
+    music))
+    
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; switch it on here, so parsing and init isn't checked (too slow!)
 ;;
@@ -611,11 +624,29 @@ Syntax:
       (set-debug-cell-accesses! 15000))
   m)
 
+(define (music-check-error music)
+  (define found #f)
+  (define (signal m)
+    (if (and (ly:music? m)
+            (eq? (ly:music-property m 'error-found) #t))
+       (set! found #t)))
+  
+  (for-each signal (ly:music-property music 'elements))
+  (signal (ly:music-property music 'element))
+
+  (if found
+      (set! (ly:music-property music 'error-found) #t))
+  music)
+
 (define-public toplevel-music-functions
   (list
    ;; check-start-chords ; ; no longer needed with chord syntax. 
-   voicify-music
-   (lambda (x) (music-map glue-mm-rest-texts x))
+   (lambda (music parser) (voicify-music music))
+   (lambda (x parser) (music-map glue-mm-rest-texts x))
+   (lambda (x parser) (music-map music-check-error x))
+   (lambda (music parser)
+
+     (music-map (quote-substitute (ly:parser-lookup parser 'musicQuotes))  music))
    ;; switch-on-debugging
    ))
 
@@ -714,8 +745,9 @@ use GrandStaff as a context. "
       ;; Accidentals are cancelled across the staves in the same grand staff as well
       ((equal? style 'piano)
        (set-accidentals-properties #f
-                                  '( Staff (same-octave . 0) (any-octave . 0) (same-octave . 1)
-                                           GrandStaff (any-octave . 0) (same-octave . 1))
+                                  '(Staff (same-octave . 0)
+                                          (any-octave . 0) (same-octave . 1)
+                                          GrandStaff (any-octave . 0) (same-octave . 1))
                                   '()
                                   pcontext))
       ((equal? style 'piano-cautionary)