From: Valentin Villenave Date: Sun, 17 Oct 2010 19:29:00 +0000 (+0200) Subject: music-functions.scm: coding style improvement. X-Git-Tag: release/2.13.36-1~8 X-Git-Url: https://git.donarmstrong.com/lilypond.git?a=commitdiff_plain;h=6f73f36cade9b9172245cbdac942eba8cc800b46;p=lilypond.git music-functions.scm: coding style improvement. This commit makes the code cleaner and more concise, by removing several duplicate parts. Since I was the one who last wrote this specific part, I'm feeling kind of compelled to clean my own mess... --- diff --git a/scm/music-functions.scm b/scm/music-functions.scm index 95587b8670..78efe3e746 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -889,7 +889,7 @@ Syntax: 'Score)))) (define (skip-as-needed music parser) - "Replace MUSIC by + "Replace MUSIC by << { \\set skipTypesetting = ##f LENGTHOF(\\showFirstLength) \\set skipTypesetting = ##t @@ -900,51 +900,56 @@ Syntax: When only showFirstLength is set, the 'length property of the music is overridden to speed up compiling." - (let* - ((show-last (ly:parser-lookup parser 'showLastLength)) - (show-first (ly:parser-lookup parser 'showFirstLength))) - (cond - - ;; both properties may be set. - ((and (ly:music? show-first) (ly:music? show-last)) - (let* - ((orig-length (ly:music-length music)) - (skip-length (ly:moment-sub orig-length (ly:music-length show-last))) - (begin-length (ly:music-length show-first))) - (make-simultaneous-music - (list - (make-sequential-music - (list - (skip-this skip-length) - ;; let's draw a separator between the beginning and the end - (context-spec-music (make-property-set 'whichBar "||") - 'Timing))) - (unskip-this begin-length) - music)))) - - ;; we may only want to print the last length - ((ly:music? show-last) - (let* - ((orig-length (ly:music-length music)) - (skip-length (ly:moment-sub orig-length (ly:music-length show-last)))) - (make-simultaneous-music - (list - (skip-this skip-length) - music)))) - - ;; we may only want to print the beginning; in this case - ;; only the first length will be processed (much faster). - ((ly:music? show-first) - (let* - ((orig-length (ly:music-length music)) - (begin-length (ly:music-length show-first))) - ;; the first length must not exceed the original length. - (if (ly:moment