X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Flily-library.scm;h=f772d0527e931efa53cdf0917fcf359012e911bb;hb=f2d3356afabababe82484a3ded193e7cc779f46a;hp=068bbb2873688b478fd0cd31ca75a0200ab5bc1b;hpb=157d98c1870868bf59c1691577444e3c3d533bc4;p=lilypond.git diff --git a/scm/lily-library.scm b/scm/lily-library.scm index 068bbb2873..f772d0527e 100644 --- a/scm/lily-library.scm +++ b/scm/lily-library.scm @@ -117,9 +117,13 @@ (let* ((paper (ly:parser-lookup parser '$defaultpaper)) (layout (ly:parser-lookup parser '$defaultlayout)) - (count (ly:parser-lookup parser 'output-count)) - (base (ly:parser-output-name parser))) + (base (ly:parser-output-name parser)) + (output-suffix (ly:parser-lookup parser 'output-suffix)) ) + + (if (string? output-suffix) + (set! base (format "~a-~a" base (string-regexp-substitute + "[^a-zA-Z0-9-]" "_" output-suffix)))) ;; must be careful: output-count is under user control. (if (not (integer? count)) @@ -127,7 +131,6 @@ (if (> count 0) (set! base (format #f "~a-~a" base count))) - (ly:parser-define! parser 'output-count (1+ count)) (process-procedure book paper layout base) )) @@ -306,13 +309,13 @@ found." (lset-difference eq? a b)) (define-public (uniq-list lst) - "Uniq LST, assuming that it is sorted" + "Uniq LST, assuming that it is sorted. Uses equal? for comparisons." (reverse! (fold (lambda (x acc) (if (null? acc) (list x) - (if (eq? x (car acc)) + (if (equal? x (car acc)) acc (cons x acc)))) '() lst) '())) @@ -488,6 +491,11 @@ found." (string-append (ly:number->string (car c)) " " (ly:number->string (cdr c)))) +(define-public (dir-basename file . rest) + "Strip suffixes in REST, but leave directory component for FILE." + (define (inverse-basename x y) (basename y x)) + (simple-format #f "~a/~a" (dirname file) + (fold inverse-basename file rest))) (define-public (write-me message x) "Return X. Display MESSAGE and write X. Handy for debugging,