lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ERROR: Unbound variable: remove ??


From: Thomas Morley
Subject: ERROR: Unbound variable: remove ??
Date: Wed, 8 May 2013 22:32:33 +0200

Hi,

I'm preparing a LSR-snippet demonstrating how to shape single Slurs
independently, which are invoked with \set doubleSlurs = ##t.
The code works fine with 2.16.2.
Though while downgrading to LSR-2.14.2 I encountered a strange problem:

Trying to compile the code below, I get:

GNU LilyPond 2.14.2
Processing `shape-double-slurs.ly'
Parsing...
Interpreting music... [8]
Preprocessing graphical objects...
Finding the ideal number of pages...
Fitting music on 1 page...
Drawing systems...ERROR: Unbound variable: remove

??
remove is not a LilyPond-procedure, it's guile _and_ it's used
elsewhere in the 2.14.2-source.

What am I missing?

-Harm

\version "2.14.2"

   #(define (read-out l1 l2)
     (define (helper ls1 ls2 ls3)
     "Filters all elements of ls1 from ls2 by their grob-name
      and appends it to ls3"
      (let ((grob-name-proc
              (lambda (x) (assq-ref (ly:grob-property x 'meta) 'name))))
       (if (null? ls1)
           ls3
           (helper
             (cdr ls1)
             ls2
             (append ls3
                     (filter (lambda (x) (eq? (car ls1) (grob-name-proc x)))
                             ls2))))))
    (helper l1 l2 '()))

   %% Thanks to David Nalesnik for his great shape-functions!!
   #(define ((shape-curve offsets) grob)
     (let* ((orig (ly:grob-original grob))
            (siblings (if (ly:spanner? grob)
                          (ly:spanner-broken-into orig) '()))
            (total-found (length siblings))
            (function (assoc-get 'control-points
                                 (reverse (ly:grob-basic-properties grob))))
            (coords (function grob)))

       (define (offset-control-points offsets)
         (if (null? offsets)
             coords
             (map
               (lambda (x y) (coord-translate x y))
               coords offsets)))

       (define (helper sibs offs)
         (if (pair? offs)
             (if (eq? (car sibs) grob)
                 (offset-control-points (car offs))
                 (helper (cdr sibs) (cdr offs)))
             coords))

       ;; we work with lists of lists
       (if (or (null? offsets)
               (not (list? (car offsets))))
           (set! offsets (list offsets)))

       (if (>= total-found 2)
           (helper siblings offsets)
           (offset-control-points (car offsets)))))

shapeDoubleSlur =
#(define-music-function (parser location offsets)(list?)
  (_i "Offset control-points of @var{Slur} by @var{offsets}.
  @var{Slur} is supposed to be invoked by @code{\\once\\set doubleSlurs = ##t}
  The argument is a list of number pairs or list of such lists.  Each element
  of a pair represents an offset to one of the coordinates of a control-point.")

#{
  \once \set doubleSlurs = ##t

  \once\override Slur #'after-line-breaking =
    #(lambda (grob)
      (let* ((sys (ly:grob-system grob))
             (elements-lst
               (ly:grob-array->list (ly:grob-object sys 'all-elements)))
             (grob-name
               (lambda (x) (assq-ref (ly:grob-property x 'meta) 'name)))
             (X-coord (lambda (x) (ly:grob-relative-coordinate x sys X)))
             (slurs (read-out (list 'Slur) elements-lst))
             (slur-X-coord (X-coord grob))
             (relevant-slurs
                 (remove (lambda (slur) (not (= slur-X-coord (X-coord slur))))
                         slurs)))
      (ly:grob-set-property!
        (car relevant-slurs)
        'control-points
        (shape-curve (car $offsets)))
      (ly:grob-set-property!
        (cadr relevant-slurs)
        'control-points
        (shape-curve (cadr $offsets)))))
#})



\relative c' {
  c1( d)
  e( f)
  \shapeDoubleSlur
    #'(
       ((0.8 . 1.8) (0.4 . 2.1) (-0.3 . 2.1) (-0.7 . 1.9))
       ((-0.1 . -2.0) (-0.3 . -3.5) (-0.5 . -3.3) (-1.0 . -2.1))
      )
  <c  e bes' c >4~( <c f a c>4)
  c2
  c1( d)
  e( f)
}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]