;;AmalgamateRepeatBarlines
(d-PushPosition)
(let ()
  (define (do-staff)
      (d-MoveToBeginning)
       (while (d-NextObject)
       		(if (d-Directive-standalone? "RepeatEnd")
       			(begin
       				(d-NextObject)
       				(if (d-Directive-standalone? "RepeatStart")
       					(begin
       						(d-SetSaved #f)
       						(d-DeleteObject)
       						(if (Appending?)
       							(d-MoveCursorLeft)
       							(d-PrevObject))
       						(d-DeleteObject)
       						(d-RepeatEndStart)))))))    
  (define (do-movement)
    (while (d-StaffUp))
    (do-staff)
    (while (d-StaffDown)
        (do-staff)))
  (while (d-PreviousMovement))
  (do-movement)
  (while (d-NextMovement)
        (do-movement)))
(d-PopPosition)