On 12 August 2011 01:44, Carl Sorensen <[email protected]> wrote:

> Yep.  Here it is, along with the change to /usr/bin/env guile.

I had to change this to

/usr/bin/guile

to get the script to work:

/usr/bin/env: guile -s: No such file or directory

> I think I'm really going to like having this, if we can get all the bugs
> worked out......

I've just tested it on a few files, and there are several problems:

1) it introduces whitespace on blank lines

2) inside an `if', comments are counted, leading to incorrect
indentation for the subexpressions

3) subexpression inside `begin' are indented only one space

4) if a top-level form is erroneously indented (e.g.,
`set-music-properties!' in music-functions.scm), the rest of the file
also gets the same indentation

I've attached a diff which only shows the indentation changes (i.e.,
tab->space conversion is ignored).

Cheers,
Neil
diff --git a/scm/music-functions.scm b/scm/music-functions.scm
index 0266f63..6c27a86 100644
--- a/scm/music-functions.scm
+++ b/scm/music-functions.scm
@@ -68,7 +68,7 @@ First it recurses over the children, then the function is applied to
 
 (define-public (music-filter pred? music)
   "Filter out music expressions that do not satisfy @var{pred?}."
-
+  
   (define (inner-music-filter pred? music)
     "Recursive function."
     (let* ((es (ly:music-property music 'elements))
@@ -89,7 +89,7 @@ First it recurses over the children, then the function is applied to
                        (ly:music? e))))
           (set! music '()))
       music))
-
+  
   (set! music (inner-music-filter pred? music))
   (if (ly:music? music)
       music
@@ -98,7 +98,7 @@ First it recurses over the children, then the function is applied to
 (define-public (display-music music)
   "Display music, not done with @code{music-map} for clarity of
 presentation."
-
+  
   (display music)
   (display ": { ")
   (let ((es (ly:music-property music 'elements))
@@ -110,8 +110,8 @@ presentation."
                (display "}\n")))
     (if (ly:music? e)
         (begin
-          (display "\nChild:")
-          (display-music e))))
+         (display "\nChild:")
+         (display-music e))))
   (display " }\n")
   music)
 
@@ -135,7 +135,7 @@ For instance,
           ((and (not (string? arg)) (markup? arg)) ;; a markup
            (inner-markup->make-markup arg))
           (else                                  ;; scheme arg
-           (music->make-music arg))))
+                (music->make-music arg))))
   (define (inner-markup->make-markup mrkup)
     (if (string? mrkup)
         `(#:simple ,mrkup)
@@ -167,20 +167,20 @@ equivalent to @var{obj}, that is, for a music expression, a
         (;; moment
          (ly:moment? obj)
          `(ly:make-moment ,(ly:moment-main-numerator obj)
-                          ,(ly:moment-main-denominator obj)
-                          ,(ly:moment-grace-numerator obj)
-                          ,(ly:moment-grace-denominator obj)))
+           ,(ly:moment-main-denominator obj)
+           ,(ly:moment-grace-numerator obj)
+           ,(ly:moment-grace-denominator obj)))
         (;; note duration
          (ly:duration? obj)
          `(ly:make-duration ,(ly:duration-log obj)
-                            ,(ly:duration-dot-count obj)
-                            ,(car (ly:duration-factor obj))
-                            ,(cdr (ly:duration-factor obj))))
+           ,(ly:duration-dot-count obj)
+           ,(car (ly:duration-factor obj))
+           ,(cdr (ly:duration-factor obj))))
         (;; note pitch
          (ly:pitch? obj)
          `(ly:make-pitch ,(ly:pitch-octave obj)
-                         ,(ly:pitch-notename obj)
-                         ,(ly:pitch-alteration obj)))
+           ,(ly:pitch-notename obj)
+           ,(ly:pitch-alteration obj)))
         (;; scheme procedure
          (procedure? obj)
          (or (procedure-name obj) obj))
@@ -196,7 +196,7 @@ equivalent to @var{obj}, that is, for a music expression, a
         (;; a pair
          (pair? obj)
          `(cons ,(music->make-music (car obj))
-                ,(music->make-music (cdr obj))))
+           ,(music->make-music (cdr obj))))
         (else
          obj)))
 
@@ -223,8 +223,8 @@ Returns `obj'.
   (parameterize ((*indent* 0)
                  (*previous-duration* (ly:make-duration 2))
                  (*force-duration* force-duration))
-    (display (music->lily-string expr parser))
-    (newline)))
+                (display (music->lily-string expr parser))
+                (newline)))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
@@ -262,11 +262,11 @@ through MUSIC."
                  (if (ly:duration? dur)
                      dur
                      (loop (cdr elts))))))))
-
+  
   (let ((talts (if (< times (length alts))
                    (begin
-                     (ly:warning (_ "More alternatives than repeats.  Junking excess alternatives"))
-                     (take alts times))
+                    (ly:warning (_ "More alternatives than repeats.  Junking excess alternatives"))
+                    (take alts times))
                    alts))
         (r (make-repeated-music name)))
     (set! (ly:music-property r 'element) main)
@@ -279,8 +279,8 @@ through MUSIC."
         (let* ((children (if (music-is-of-type? main 'sequential-music)
                              ;; \repeat tremolo n { ... }
                              (length (extract-named-music main 'EventChord))
-                             ;; \repeat tremolo n c4
-                             1))
+                           ;; \repeat tremolo n c4
+                           1))
                ;; # of dots is equal to the 1 in bitwise representation (minus 1)!
                (dots (1- (logcount (* times children))))
                ;; The remaining missing multiplicator to scale the notes by
@@ -299,7 +299,7 @@ through MUSIC."
           (ly:music-compress r (ly:make-moment 1 children))
           ;; Adjust the displayed note durations
           (shift-duration-log r shift dots))
-        r)))
+      r)))
 
 (define (calc-repeat-slash-count music)
   "Given the child-list @var{music} in @code{PercentRepeatMusic},
@@ -310,7 +310,7 @@ beats to be distinguished."
                       (duration-of-note elt))
                     (extract-named-music music 'EventChord)))
          (first-dur (car durs)))
-
+    
     (if (every (lambda (d) (equal? d first-dur)) durs)
         (max (- (ly:duration-log first-dur) 2) 1)
         0)))
@@ -334,17 +334,17 @@ beats to be distinguished."
 
 (define-public (unfold-repeats music)
   "Replace all repeats with unfolded repeats."
-
+  
   (let ((es (ly:music-property music 'elements))
         (e (ly:music-property music 'element)))
-
+    
     (if (memq 'repeated-music (ly:music-property music 'types))
         (let* ((props (ly:music-mutable-properties music))
                (old-name (ly:music-property music 'name))
                (flattened (flatten-alist props)))
           (set! music (apply make-music (cons 'UnfoldedRepeatedMusic
                                               flattened)))
-
+          
           (if (equal? old-name 'TremoloRepeatedMusic)
               (let* ((seq-arg? (memq 'sequential-music
                                      (ly:music-property e 'types)))
@@ -354,17 +354,17 @@ beats to be distinguished."
                      (child-count (if seq-arg?
                                       (length (ly:music-property e 'elements))
                                       0)))
-
+                
                 (if (= 0 -1)
                     (set! count (* 2 (quotient count 3))))
-
+                
                 (shift-duration-log music (+ (if (= 2 child-count)
                                                  1 0)
                                              (ly:intlog2 count)) dot-shift)
-
+                
                 (if seq-arg?
                     (ly:music-compress e (ly:make-moment child-count 1)))))))
-
+    
     (if (pair? es)
         (set! (ly:music-property music 'elements)
               (map unfold-repeats es)))
@@ -436,7 +436,7 @@ in @var{grob}."
                           (Voice Script font-size -3)
                           (Voice Fingering font-size -8)
                           (Voice StringNumber font-size -8)))
-
+     
      (make-grob-property-set 'NoteColumn 'horizontal-shift (quotient n 2))
      (make-grob-property-set 'MultiMeasureRest 'staff-position (if (odd? n) -4 4))))))
 
@@ -544,44 +544,44 @@ If @var{rest} is present, it is used to set @code{beatStructure}."
 (define-public (override-head-style heads style)
   "Override style for @var{heads} to @var{style}."
   (make-sequential-music
-    (if (pair? heads)
-        (map (lambda (h)
+   (if (pair? heads)
+       (map (lambda (h)
               (make-grob-property-override h 'style style))
-         heads)
-        (list (make-grob-property-override heads 'style style)))))
+            heads)
+       (list (make-grob-property-override heads 'style style)))))
 
 (define-public (revert-head-style heads)
   "Revert style for @var{heads}."
   (make-sequential-music
-    (if (pair? heads)
-        (map (lambda (h)
+   (if (pair? heads)
+       (map (lambda (h)
               (make-grob-property-revert h 'style))
-         heads)
-        (list (make-grob-property-revert heads 'style)))))
+            heads)
+       (list (make-grob-property-revert heads 'style)))))
 
 (define-public (style-note-heads heads style music)
- "Set @var{style} for all @var{heads} in @var{music}.  Works both
+  "Set @var{style} for all @var{heads} in @var{music}.  Works both
 inside of and outside of chord construct."
   ;; are we inside a <...>?
   (if (eq? (ly:music-property music 'name) 'NoteEvent)
       ;; yes -> use a tweak
       (begin
-        (set! (ly:music-property music 'tweaks)
-              (acons 'style style (ly:music-property music 'tweaks)))
-        music)
-      ;; not in <...>, so use overrides
-      (make-sequential-music
-        (list
-          (override-head-style heads style)
-          music
-          (revert-head-style heads)))))
+       (set! (ly:music-property music 'tweaks)
+             (acons 'style style (ly:music-property music 'tweaks)))
+       music)
+    ;; not in <...>, so use overrides
+    (make-sequential-music
+     (list
+      (override-head-style heads style)
+      music
+      (revert-head-style heads)))))
 
 (define-public (set-mus-properties! m alist)
   "Set all of @var{alist} as properties of @var{m}."
   (if (pair? alist)
       (begin
-        (set! (ly:music-property m (caar alist)) (cdar alist))
-        (set-mus-properties! m (cdr alist)))))
+       (set! (ly:music-property m (caar alist)) (cdar alist))
+       (set-mus-properties! m (cdr alist)))))
 
 (define-public (music-separator? m)
   "Is @var{m} a separator?"
@@ -619,7 +619,7 @@ NUMBER is 0-base, i.e., Voice=1 (upstems) has number 0.
       (ly:error (_ "music expected: ~S") m))
   (let ((es (ly:music-property m 'elements))
         (e (ly:music-property m 'element)))
-
+    
     (if (pair? es)
         (set! (ly:music-property m 'elements) (map voicify-music es)))
     (if (ly:music? e)
@@ -668,10 +668,10 @@ NUMBER is 0-base, i.e., Voice=1 (upstems) has number 0.
 (define-public (skip->rest mus)
   "Replace @var{mus} by @code{RestEvent} of the same duration if it is a
 @code{SkipEvent}.  Useful for extracting parts from crowded scores."
-
+  
   (if  (memq (ly:music-property mus 'name) '(SkipEvent SkipMusic))
-   (make-music 'RestEvent 'duration (ly:music-property mus 'duration))
-   mus))
+      (make-music 'RestEvent 'duration (ly:music-property mus 'duration))
+      mus))
 
 
 (define-public (music-has-type music type)
@@ -683,7 +683,7 @@ NUMBER is 0-base, i.e., Voice=1 (upstems) has number 0.
         acc
         (alist->args (cdr alist)
                      (cons (caar alist) (cons (cdar alist) acc)))))
-
+  
   (apply
    make-music
    (ly:music-property music 'name)
@@ -745,12 +745,12 @@ NUMBER is 0-base, i.e., Voice=1 (upstems) has number 0.
     (let* ((where (ly:context-property-where-defined context 'graceSettings))
            (current (ly:context-property where 'graceSettings))
            (prop-settings (filter
-                            (lambda(x) (sym-grob-context? x sym grob context-name))
-                            current))
+                           (lambda(x) (sym-grob-context? x sym grob context-name))
+                           current))
            (new-settings current))
       (for-each (lambda(x)
-                 (set! new-settings (delete x new-settings)))
-               prop-settings)
+                    (set! new-settings (delete x new-settings)))
+                prop-settings)
       (ly:context-set-property! where 'graceSettings new-settings)))
   (ly:export (context-spec-music (make-apply-context delete-prop) 'Voice)))
 
@@ -759,13 +759,13 @@ NUMBER is 0-base, i.e., Voice=1 (upstems) has number 0.
 (defmacro-public def-grace-function (start stop . docstring)
   "Helper macro for defining grace music"
   `(define-music-function (parser location music) (ly:music?)
-     ,@docstring
-     (make-music 'GraceMusic
-                 'origin location
-                 'element (make-music 'SequentialMusic
-                                      'elements (list (ly:music-deep-copy ,start)
-                                                      music
-                                                      (ly:music-deep-copy ,stop))))))
+    ,@docstring
+    (make-music 'GraceMusic
+                'origin location
+                'element (make-music 'SequentialMusic
+                                     'elements (list (ly:music-deep-copy ,start)
+                                                     music
+                                                     (ly:music-deep-copy ,stop))))))
 
 (defmacro-public define-music-function (args signature . body)
   "Helper macro for `ly:make-music-function'.
@@ -773,25 +773,25 @@ Syntax:
   (define-music-function (parser location arg1 arg2 ...) (arg1-type? arg2-type? ...)
     ...function body...)
 "
-(if (and (pair? body) (pair? (car body)) (eqv? '_i (caar body)))
+  (if (and (pair? body) (pair? (car body)) (eqv? '_i (caar body)))
       ;; When the music function definition contains a i10n doc string,
       ;; (_i "doc string"), keep the literal string only
-      (let ((docstring (cadar body))
-            (body (cdr body)))
-        `(ly:make-music-function (list ,@signature)
-                                 (lambda (,@args)
-                                   ,docstring
-                                   ,@body)))
+    (let ((docstring (cadar body))
+          (body (cdr body)))
       `(ly:make-music-function (list ,@signature)
-                               (lambda (,@args)
-                                 ,@body))))
+        (lambda (,@args)
+          ,docstring
+          ,@body)))
+    `(ly:make-music-function (list ,@signature)
+      (lambda (,@args)
+        ,@body))))
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (define-public (cue-substitute quote-music)
   "Must happen after @code{quote-substitute}."
-
+  
   (if (vector? (ly:music-property quote-music 'quoted-events))
       (let* ((dir (ly:music-property quote-music 'quoted-voice-direction))
              (clef (ly:music-property quote-music 'quoted-music-clef))
@@ -799,34 +799,34 @@ Syntax:
              (cue-voice (if (eq? 1 dir) 0 1))
              (main-music (ly:music-property quote-music 'element))
              (return-value quote-music))
-
+        
         (if (or (eq? 1 dir) (eq? -1 dir))
-
+            
             ;; if we have stem dirs, change both quoted and main music
-            ;; to have opposite stems.
-            (begin
-              (set! return-value
-                    ;; cannot context-spec Quote-music, since context
-                    ;; for the quotes is determined in the iterator.
-                    (make-sequential-music
-                     (list
-                      (if (null? clef)
-                          (make-music 'Music)
-                          (make-cue-clef-set clef))
-                      (context-spec-music (make-voice-props-set cue-voice) 'CueVoice "cue")
-                      quote-music
-                      (context-spec-music (make-voice-props-revert) 'CueVoice "cue")
-                      (if (null? clef)
-                          (make-music 'Music)
-                          (make-cue-clef-unset)))))
-              (set! main-music
-                    (make-sequential-music
-                     (list
-                      (make-voice-props-set main-voice)
-                      main-music
-                      (make-voice-props-revert))))
-              (set! (ly:music-property quote-music 'element) main-music)))
-
+          ;; to have opposite stems.
+          (begin
+           (set! return-value
+                 ;; cannot context-spec Quote-music, since context
+                 ;; for the quotes is determined in the iterator.
+                 (make-sequential-music
+                  (list
+                   (if (null? clef)
+                       (make-music 'Music)
+                       (make-cue-clef-set clef))
+                   (context-spec-music (make-voice-props-set cue-voice) 'CueVoice "cue")
+                   quote-music
+                   (context-spec-music (make-voice-props-revert) 'CueVoice "cue")
+                   (if (null? clef)
+                       (make-music 'Music)
+                       (make-cue-clef-unset)))))
+           (set! main-music
+                 (make-sequential-music
+                  (list
+                   (make-voice-props-set main-voice)
+                   main-music
+                   (make-voice-props-revert))))
+           (set! (ly:music-property quote-music 'element) main-music)))
+        
         return-value)
       quote-music))
 
@@ -834,14 +834,14 @@ Syntax:
   (let* ((quoted-name (ly:music-property music 'quoted-music-name))
          (quoted-vector (and (string? quoted-name)
                              (hash-ref quote-tab quoted-name #f))))
-
-
+    
+    
     (if (string? quoted-name)
         (if (vector? quoted-vector)
             (begin
-              (set! (ly:music-property music 'quoted-events) quoted-vector)
-              (set! (ly:music-property music 'iterator-ctor)
-                    ly:quote-iterator::constructor))
+             (set! (ly:music-property music 'quoted-events) quoted-vector)
+             (set! (ly:music-property music 'iterator-ctor)
+                   ly:quote-iterator::constructor))
             (ly:music-message music (ly:format (_ "cannot find quoted music: `~S'") quoted-name))))
     music))
 
@@ -862,10 +862,10 @@ Syntax:
     (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)
@@ -876,23 +876,23 @@ Syntax:
   music)
 
 (define-public (make-duration-of-length moment)
- "Make duration of the given @code{moment} length."
- (ly:make-duration 0 0
-  (ly:moment-main-numerator moment)
-  (ly:moment-main-denominator moment)))
+  "Make duration of the given @code{moment} length."
+  (ly:make-duration 0 0
+                    (ly:moment-main-numerator moment)
+                    (ly:moment-main-denominator moment)))
 
 (define (make-skipped moment bool)
- "Depending on BOOL, set or unset skipTypesetting,
+  "Depending on BOOL, set or unset skipTypesetting,
 then make SkipMusic of the given MOMENT length, and
 then revert skipTypesetting."
- (make-sequential-music
-  (list
-   (context-spec-music (make-property-set 'skipTypesetting bool)
-    'Score)
-   (make-music 'SkipMusic 'duration
-    (make-duration-of-length moment))
-   (context-spec-music (make-property-set 'skipTypesetting (not bool))
-    'Score))))
+  (make-sequential-music
+   (list
+    (context-spec-music (make-property-set 'skipTypesetting bool)
+                        'Score)
+    (make-music 'SkipMusic 'duration
+                (make-duration-of-length moment))
+    (context-spec-music (make-property-set 'skipTypesetting (not bool))
+                        'Score))))
 
 (define (skip-as-needed music parser)
   "Replace MUSIC by
@@ -914,12 +914,12 @@ then revert skipTypesetting."
        (show-first-length (and (ly:music? show-first)
                                (ly:music-length show-first)))
        (orig-length (ly:music-length music)))
-
+    
     ;;FIXME: if using either showFirst- or showLastLength,
     ;; make sure that skipBars is not set.
-
+    
     (cond
-
+     
      ;; both properties may be set.
      ((and show-first-length show-last-length)
       (let
@@ -934,7 +934,7 @@ then revert skipTypesetting."
                                 'Timing)))
           (make-skipped show-first-length #f)
           music))))
-
+     
      ;; we may only want to print the last length
      (show-last-length
       (let
@@ -943,7 +943,7 @@ then revert skipTypesetting."
          (list
           (make-skipped skip-length #t)
           music))))
-
+     
      ;; we may only want to print the beginning; in this case
      ;; only the first length will be processed (much faster).
      (show-first-length
@@ -952,7 +952,7 @@ then revert skipTypesetting."
           (set! (ly:music-property music 'length)
                 show-first-length))
       music)
-
+     
      (else music))))
 
 
@@ -962,15 +962,15 @@ then revert skipTypesetting."
    (lambda (x parser) (music-map music-check-error x))
    (lambda (x parser) (music-map precompute-music-length x))
    (lambda (music parser)
-
+     
      (music-map (quote-substitute (ly:parser-lookup parser 'musicQuotes))  music))
-
+   
    ;; switch-on-debugging
    (lambda (x parser) (music-map cue-substitute x))
-
+   
    (lambda (x parser)
      (skip-as-needed x parser)
-   )))
+     )))
 
 ;;;;;;;;;;
 ;;; general purpose music functions
@@ -978,9 +978,9 @@ then revert skipTypesetting."
 (define (shift-octave pitch octave-shift)
   (_i "Add @var{octave-shift} to the octave of @var{pitch}.")
   (ly:make-pitch
-     (+ (ly:pitch-octave pitch) octave-shift)
-     (ly:pitch-notename pitch)
-     (ly:pitch-alteration pitch)))
+   (+ (ly:pitch-octave pitch) octave-shift)
+   (ly:pitch-notename pitch)
+   (ly:pitch-alteration pitch)))
 
 
 ;;;;;;;;;;;;;;;;;
@@ -991,9 +991,9 @@ then revert skipTypesetting."
     (if (and (not (equal? (ly:music-length music) ZERO-MOMENT))
              (ly:duration?  (ly:music-property music 'duration)))
         (begin
-          (set! (ly:music-property music 'duration) (car durations))
-          (set! durations (cdr durations)))))
-
+         (set! (ly:music-property music 'duration) (car durations))
+         (set! durations (cdr durations)))))
+  
   (music-map apply-duration lyric-music))
 
 
@@ -1050,13 +1050,13 @@ specifies whether accidentals should be canceled in different octaves."
          (from-other-octaves #f)
          (from-same-octave (assoc-get pitch-handle local-key-sig))
          (from-key-sig (or (assoc-get notename local-key-sig)
-
-    ;; If no key signature match is found from localKeySignature, we may have a custom
-    ;; type with octave-specific entries of the form ((octave . pitch) alteration)
-    ;; instead of (pitch . alteration).  Since this type cannot coexist with entries in
-    ;; localKeySignature, try extracting from keySignature instead.
+                           
+                           ;; If no key signature match is found from localKeySignature, we may have a custom
+                           ;; type with octave-specific entries of the form ((octave . pitch) alteration)
+                           ;; instead of (pitch . alteration).  Since this type cannot coexist with entries in
+                           ;; localKeySignature, try extracting from keySignature instead.
                            (assoc-get pitch-handle key-sig))))
-
+    
     ;; loop through localKeySignature to search for a notename match from other octaves
     (let loop ((l local-key-sig))
       (if (pair? l)
@@ -1065,7 +1065,7 @@ specifies whether accidentals should be canceled in different octaves."
                      (= (cdar entry) notename))
                 (set! from-other-octaves (cdr entry))
                 (loop (cdr l))))))
-
+    
     ;; find previous alteration-def for comparison with pitch
     (cond
      ;; from same octave?
@@ -1073,31 +1073,31 @@ specifies whether accidentals should be canceled in different octaves."
            from-same-octave
            (recent-enough? barnum from-same-octave laziness))
       (set! previous-alteration from-same-octave))
-
+     
      ;; from any octave?
      ((and ignore-octave
            from-other-octaves
            (recent-enough? barnum from-other-octaves laziness))
       (set! previous-alteration from-other-octaves))
-
+     
      ;; not recent enough, extract from key signature/local key signature
      (from-key-sig
       (set! previous-alteration from-key-sig)))
-
+    
     (if (accidental-invalid? previous-alteration)
         (set! need-accidental #t)
-
-        (let* ((prev-alt (extract-alteration previous-alteration))
-               (this-alt (ly:pitch-alteration pitch)))
-
-          (if (not (= this-alt prev-alt))
-              (begin
-                (set! need-accidental #t)
-                (if (and (not (= this-alt 0))
-                         (and (< (abs this-alt) (abs prev-alt))
-                             (> (* prev-alt this-alt) 0)))
-                    (set! need-restore #t))))))
-
+        
+      (let* ((prev-alt (extract-alteration previous-alteration))
+             (this-alt (ly:pitch-alteration pitch)))
+        
+        (if (not (= this-alt prev-alt))
+            (begin
+             (set! need-accidental #t)
+             (if (and (not (= this-alt 0))
+                      (and (< (abs this-alt) (abs prev-alt))
+                           (> (* prev-alt this-alt) 0)))
+                 (set! need-restore #t))))))
+    
     (cons need-restore need-accidental)))
 
 (define-public ((make-accidental-rule octaveness laziness) context pitch barnum measurepos)
@@ -1116,7 +1116,7 @@ active pitch in any octave.
 is, to the end of current measure.  A positive integer means that the
 accidental lasts over that many bar lines.  @code{-1} is `forget
 immediately', that is, only look at key signature.  @code{#t} is `forever'."
-
+  
   (check-pitch-against-signature context pitch barnum laziness octaveness))
 
 (define (key-entry-notename entry)
@@ -1242,8 +1242,8 @@ as a context."
       ((equal? style 'modern)
        (set-accidentals-properties #f
                                    `(Staff ,(make-accidental-rule 'same-octave 0)
-                                           ,(make-accidental-rule 'any-octave 0)
-                                           ,(make-accidental-rule 'same-octave 1))
+                                     ,(make-accidental-rule 'any-octave 0)
+                                     ,(make-accidental-rule 'same-octave 1))
                                    '()
                                    context))
       ;; the accidentals that Stone adds to the old standard as cautionaries
@@ -1251,47 +1251,47 @@ as a context."
        (set-accidentals-properties #f
                                    `(Staff ,(make-accidental-rule 'same-octave 0))
                                    `(Staff ,(make-accidental-rule 'any-octave 0)
-                                           ,(make-accidental-rule 'same-octave 1))
+                                     ,(make-accidental-rule 'same-octave 1))
                                    context))
       ;; same as modern, but accidentals different from the key signature are always
       ;; typeset - unless they directly follow a note of the same pitch.
       ((equal? style 'neo-modern)
        (set-accidentals-properties #f
                                    `(Staff ,(make-accidental-rule 'same-octave 0)
-                                           ,(make-accidental-rule 'any-octave 0)
-                                           ,(make-accidental-rule 'same-octave 1)
-                                           ,neo-modern-accidental-rule)
+                                     ,(make-accidental-rule 'any-octave 0)
+                                     ,(make-accidental-rule 'same-octave 1)
+                                     ,neo-modern-accidental-rule)
                                    '()
                                    context))
       ((equal? style 'neo-modern-cautionary)
        (set-accidentals-properties #f
                                    `(Staff ,(make-accidental-rule 'same-octave 0))
                                    `(Staff ,(make-accidental-rule 'any-octave 0)
-                                           ,(make-accidental-rule 'same-octave 1)
-                                           ,neo-modern-accidental-rule)
+                                     ,(make-accidental-rule 'same-octave 1)
+                                     ,neo-modern-accidental-rule)
                                    context))
       ((equal? style 'neo-modern-voice)
        (set-accidentals-properties #f
                                    `(Voice ,(make-accidental-rule 'same-octave 0)
-                                           ,(make-accidental-rule 'any-octave 0)
-                                           ,(make-accidental-rule 'same-octave 1)
-                                           ,neo-modern-accidental-rule
+                                     ,(make-accidental-rule 'any-octave 0)
+                                     ,(make-accidental-rule 'same-octave 1)
+                                     ,neo-modern-accidental-rule
                                      Staff ,(make-accidental-rule 'same-octave 0)
-                                           ,(make-accidental-rule 'any-octave 0)
-                                           ,(make-accidental-rule 'same-octave 1)
-                                      ,neo-modern-accidental-rule)
+                                     ,(make-accidental-rule 'any-octave 0)
+                                     ,(make-accidental-rule 'same-octave 1)
+                                     ,neo-modern-accidental-rule)
                                    '()
                                    context))
       ((equal? style 'neo-modern-voice-cautionary)
        (set-accidentals-properties #f
                                    `(Voice ,(make-accidental-rule 'same-octave 0))
                                    `(Voice ,(make-accidental-rule 'any-octave 0)
-                                           ,(make-accidental-rule 'same-octave 1)
-                                           ,neo-modern-accidental-rule
+                                     ,(make-accidental-rule 'same-octave 1)
+                                     ,neo-modern-accidental-rule
                                      Staff ,(make-accidental-rule 'same-octave 0)
-                                           ,(make-accidental-rule 'any-octave 0)
-                                           ,(make-accidental-rule 'same-octave 1)
-                                           ,neo-modern-accidental-rule)
+                                     ,(make-accidental-rule 'any-octave 0)
+                                     ,(make-accidental-rule 'same-octave 1)
+                                     ,neo-modern-accidental-rule)
                                    context))
       ;; Accidentals as they were common in dodecaphonic music with no tonality.
       ;; Each note gets one accidental.
@@ -1305,56 +1305,56 @@ as a context."
       ;; Accidentals are typeset for each voice, but they ARE cancelled across voices.
       ((equal? style 'modern-voice)
        (set-accidentals-properties  #f
-                                    `(Voice ,(make-accidental-rule 'same-octave 0)
-                                            ,(make-accidental-rule 'any-octave 0)
-                                            ,(make-accidental-rule 'same-octave 1)
-                                      Staff ,(make-accidental-rule 'same-octave 0)
-                                            ,(make-accidental-rule 'any-octave 0)
-                                            ,(make-accidental-rule 'same-octave 1))
-                                    '()
-                                    context))
+                                   `(Voice ,(make-accidental-rule 'same-octave 0)
+                                     ,(make-accidental-rule 'any-octave 0)
+                                     ,(make-accidental-rule 'same-octave 1)
+                                     Staff ,(make-accidental-rule 'same-octave 0)
+                                     ,(make-accidental-rule 'any-octave 0)
+                                     ,(make-accidental-rule 'same-octave 1))
+                                   '()
+                                   context))
       ;; same as modernVoiceAccidental eccept that all special accidentals are typeset
       ;; as cautionaries
       ((equal? style 'modern-voice-cautionary)
        (set-accidentals-properties #f
                                    `(Voice ,(make-accidental-rule 'same-octave 0))
                                    `(Voice ,(make-accidental-rule 'any-octave 0)
-                                           ,(make-accidental-rule 'same-octave 1)
+                                     ,(make-accidental-rule 'same-octave 1)
                                      Staff ,(make-accidental-rule 'same-octave 0)
-                                           ,(make-accidental-rule 'any-octave 0)
-                                           ,(make-accidental-rule 'same-octave 1))
+                                     ,(make-accidental-rule 'any-octave 0)
+                                     ,(make-accidental-rule 'same-octave 1))
                                    context))
       ;; stone's suggestions for accidentals on grand staff.
       ;; Accidentals are cancelled across the staves in the same grand staff as well
       ((equal? style 'piano)
        (set-accidentals-properties #f
                                    `(Staff ,(make-accidental-rule 'same-octave 0)
-                                           ,(make-accidental-rule 'any-octave 0)
-                                           ,(make-accidental-rule 'same-octave 1)
+                                     ,(make-accidental-rule 'any-octave 0)
+                                     ,(make-accidental-rule 'same-octave 1)
                                      GrandStaff
-                                           ,(make-accidental-rule 'any-octave 0)
-                                           ,(make-accidental-rule 'same-octave 1))
+                                     ,(make-accidental-rule 'any-octave 0)
+                                     ,(make-accidental-rule 'same-octave 1))
                                    '()
                                    pcontext))
       ((equal? style 'piano-cautionary)
        (set-accidentals-properties #f
                                    `(Staff ,(make-accidental-rule 'same-octave 0))
                                    `(Staff ,(make-accidental-rule 'any-octave 0)
-                                           ,(make-accidental-rule 'same-octave 1)
+                                     ,(make-accidental-rule 'same-octave 1)
                                      GrandStaff
-                                           ,(make-accidental-rule 'any-octave 0)
-                                           ,(make-accidental-rule 'same-octave 1))
+                                     ,(make-accidental-rule 'any-octave 0)
+                                     ,(make-accidental-rule 'same-octave 1))
                                    pcontext))
-
+      
       ;; same as modern, but cautionary accidentals are printed for all sharp or flat
       ;; tones specified by the key signature.
-       ((equal? style 'teaching)
+      ((equal? style 'teaching)
        (set-accidentals-properties #f
-                                    `(Staff ,(make-accidental-rule 'same-octave 0))
-                                    `(Staff ,(make-accidental-rule 'same-octave 1)
-                                           ,teaching-accidental-rule)
+                                   `(Staff ,(make-accidental-rule 'same-octave 0))
+                                   `(Staff ,(make-accidental-rule 'same-octave 1)
+                                     ,teaching-accidental-rule)
                                    context))
-
+      
       ;; do not set localKeySignature when a note alterated differently from
       ;; localKeySignature is found.
       ;; Causes accidentals to be printed at every note instead of
@@ -1407,7 +1407,7 @@ Entries that conform with the current key signature are not invalidated."
                    entry
                    (cons (car entry) (cons 'clef (cddr entry))))))
            (ly:context-property context 'localKeySignature)))))
-                    
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (define-public (skip-of-length mus)
@@ -1416,12 +1416,12 @@ Entries that conform with the current key signature are not invalidated."
           (make-music
            'SkipEvent
            'duration (ly:make-duration 0 0))))
-
+    
     (make-event-chord (list (ly:music-compress skip (ly:music-length mus))))))
 
 (define-public (mmrest-of-length mus)
   "Create a multi-measure rest of exactly the same length as @var{mus}."
-
+  
   (let* ((skip
           (make-multi-measure-rest
            (ly:make-duration 0 0) '())))
@@ -1432,7 +1432,7 @@ Entries that conform with the current key signature are not invalidated."
   (let ((evs (filter (lambda (x)
                        (music-has-type x 'note-event))
                      (ly:music-property event-chord 'elements))))
-
+    
     (and (pair? evs)
          (ly:music-property (car evs) 'pitch))))
 
@@ -1440,7 +1440,7 @@ Entries that conform with the current key signature are not invalidated."
   (let ((evs (filter (lambda (x)
                        (music-has-type x 'rhythmic-event))
                      (ly:music-property event-chord 'elements))))
-
+    
     (and (pair? evs)
          (ly:music-property (car evs) 'duration))))
 
@@ -1448,27 +1448,27 @@ Entries that conform with the current key signature are not invalidated."
 
 (define-public (extract-named-music music music-name)
   "Return a flat list of all music named @var{music-name} from @var{music}."
-   (let ((extracted-list
-          (if (ly:music? music)
-              (if (eq? (ly:music-property music 'name) music-name)
-                  (list music)
-                  (let ((elt (ly:music-property music 'element))
-                        (elts (ly:music-property music 'elements)))
-                    (if (ly:music? elt)
-                        (extract-named-music elt music-name)
-                        (if (null? elts)
-                            '()
-                            (map (lambda(x)
+  (let ((extracted-list
+         (if (ly:music? music)
+             (if (eq? (ly:music-property music 'name) music-name)
+                 (list music)
+                 (let ((elt (ly:music-property music 'element))
+                       (elts (ly:music-property music 'elements)))
+                   (if (ly:music? elt)
+                       (extract-named-music elt music-name)
+                       (if (null? elts)
+                           '()
+                           (map (lambda(x)
                                     (extract-named-music x music-name ))
-                             elts)))))
-              '())))
-     (flatten-list extracted-list)))
+                                elts)))))
+             '())))
+    (flatten-list extracted-list)))
 
 (define-public (event-chord-notes event-chord)
   "Return a list of all notes from @var{event-chord}."
   (filter
-    (lambda (m) (eq? 'NoteEvent (ly:music-property m 'name)))
-    (ly:music-property event-chord 'elements)))
+   (lambda (m) (eq? 'NoteEvent (ly:music-property m 'name)))
+   (ly:music-property event-chord 'elements)))
 
 (define-public (event-chord-pitches event-chord)
   "Return a list of all pitches from @var{event-chord}."
_______________________________________________
lilypond-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to