]> git.donarmstrong.com Git - lilypond.git/commitdiff
Merge branch 'master' of ssh+git://hanwen@git.sv.gnu.org/srv/git/lilypond
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 11 Dec 2006 12:37:59 +0000 (13:37 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 11 Dec 2006 12:37:59 +0000 (13:37 +0100)
scm/lily-library.scm
scripts/lilypond-invoke-editor.scm

index fc8d291dec662e041b4513336aaea10b94934230..283f9a17090643f900882f46a821e4b9ed32f0dc 100644 (file)
@@ -6,6 +6,8 @@
 ;;;; (c) 1998--2006 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;;; Han-Wen Nienhuys <hanwen@xs4all.nl>
 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; constants.
 
 (define-public X 0)
 (define-public Y 1)
 (define-safe-public DOUBLE-SHARP 4)
 (define-safe-public SEMI-TONE 2)
 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; moments
+
 (define-public ZERO-MOMENT (ly:make-moment 0 1)) 
 
 (define-public (moment-min a b)
   (if (ly:moment<? a b) a b))
 
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; arithmetic
 (define-public (average x . lst)
   (/ (+ x (apply + lst)) (1+ (length lst))))
 
 
 ;;;;;;;;;;;;;;;;
 ;; alist
+
 (define-public assoc-get ly:assoc-get)
 
 (define-public (uniqued-alist alist acc)
@@ -192,6 +201,7 @@ found."
 
 ;;;;;;;;;;;;;;;;
 ;; vector
+
 (define-public (vector-for-each proc vec)
   (do
       ((i 0 (1+ i)))
@@ -269,6 +279,7 @@ found."
 
 (define-public (count-list lst)
   "Given lst (E1 E2 .. ) return ((E1 . 1) (E2 . 2) ... )  "
+
   (define (helper l acc count)
     (if (pair? l)
        (helper (cdr l) (cons (cons (car l) count) acc) (1+ count))
@@ -305,19 +316,17 @@ found."
   "Return list of elements in A that are not in B."
   (lset-difference eq? a b))
 
-;; TODO: use the srfi-1 partition function.
-(define-public (uniq-list lst)
-  
+(define (uniq lst)
   "Uniq LST, assuming that it is sorted"
-  (define (helper acc lst) 
-    (if (null? lst)
-       acc
-       (if (null? (cdr lst))
-           (cons (car lst) acc)
-           (if (equal? (car lst) (cadr lst))
-               (helper acc (cdr lst))
-               (helper (cons (car lst) acc)  (cdr lst))))))
-  (reverse! (helper '() lst) '()))
+
+  (reverse! 
+   (fold (lambda (x acc)
+          (if (null? acc)
+              (list x)
+              (if (eq? x (car acc))
+                  acc
+                  (cons x acc))))
+        '() lst) '()))
 
 (define (split-at-predicate predicate lst)
  "Split LST = (a_1 a_2 ... a_k b_1 ... b_k)
index 048ac3f53b3021fa005478e3ace188f1e3fd02f4..275aa901d88304e05d08f1cd1cbaffddbdf1c8f9 100755 (executable)
@@ -12,6 +12,7 @@
 (use-modules
  (ice-9 getopt-long)
  (ice-9 regex)
+ (srfi srfi-1)
  (srfi srfi-13)
  (srfi srfi-14))
 
@@ -23,7 +24,6 @@
 
 ;; argv0 relocation -- do in wrapper?
 
-
 (define LILYPONDPREFIX
   (let* ((prefix
          (or (getenv "LILYPONDPREFIX")
@@ -124,6 +124,19 @@ Options:
        (format "~a ~a" (getenv "BROWSER") uri)
        (format #f "firefox -remote 'OpenURL(~a,new-tab)'" uri))))
 
+
+(define (strip-framework-path var)
+  (define pat "lilypond/usr")
+  (let*
+      ((val (getenv var))
+       (paths (string-split val #\:))
+       (without (remove (lambda (s) (string-contains s pat))
+                       paths)))
+
+    (if (not (= (length without)
+               (length paths)))
+       (setenv var (string-join without ":")))))
+
 (define (main args)
   (let ((files (parse-options args)))
     (if (running-from-gui?)
@@ -138,8 +151,10 @@ Options:
          (show-help (current-error-port))
          (exit 2)))
     (set! %load-path (cons LILYPONDPREFIX %load-path))
+
     (primitive-eval '(use-modules (scm editor)))
 
+    (strip-framework-path "LD_LIBRARY_PATH")
     (let* ((uri (car files)))
       (if (is-textedit-uri? uri)
          (run-editor uri)