From: David Kastrup Date: Sun, 12 Jul 2015 10:27:42 +0000 (+0200) Subject: Issue 4501/2: Use music-type-predicate where useful X-Git-Tag: release/2.19.24-1~5^2~17 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=29014c76529166d5eadb4bad4f602d881a25a6a5;p=lilypond.git Issue 4501/2: Use music-type-predicate where useful --- diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index 8e6483184f..01169d1e95 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -1859,10 +1859,10 @@ unsets already in @var{music} cause a warning. Non-property-related music is ig (let ((lst (fold-some-music - (lambda (m) (or (music-is-of-type? m 'layout-instruction-event) - (music-is-of-type? m 'context-specification) - (music-is-of-type? m 'apply-context) - (music-is-of-type? m 'time-signature-music))) + (music-type-predicate '(layout-instruction-event + context-specification + apply-context + time-signature-music)) (lambda (m overrides) (case (ly:music-property m 'name) ((OverrideProperty) diff --git a/scm/define-music-display-methods.scm b/scm/define-music-display-methods.scm index 01eae4bfbb..c1ee87bbf8 100644 --- a/scm/define-music-display-methods.scm +++ b/scm/define-music-display-methods.scm @@ -126,8 +126,7 @@ expression." ;;; post events ;;; -(define (post-event? m) - (music-is-of-type? m 'post-event)) +(define post-event? (music-type-predicate 'post-event)) (define* (event-direction->lily-string event #:optional (required #t)) (let ((direction (ly:music-property event 'direction))) @@ -418,7 +417,7 @@ Otherwise, return #f." (chord-repeat (ly:music-property chord 'duration))) (call-with-values (lambda () - (partition (lambda (m) (music-is-of-type? m 'rhythmic-event)) + (partition (music-type-predicate 'rhythmic-event) elements)) (lambda (chord-elements other-elements) (cond ((pair? chord-elements) diff --git a/scm/music-functions.scm b/scm/music-functions.scm index 132f2f2369..304becef03 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -747,9 +747,7 @@ duration is replaced with the specified @var{duration}." ;; articulations on individual events since they can't actually get ;; into a repeat chord given its input syntax. - (define (keep-element? m) - (any (lambda (t) (music-is-of-type? m t)) - event-types)) + (define keep-element? (music-type-predicate event-types)) (for-each (lambda (field) @@ -2006,12 +2004,7 @@ not recursing into matches themselves." "Return a flat list of all music with @var{type} (either a single type symbol or a list of alternatives) inside of @var{music}, not recursing into matches themselves." - (extract-music - music - (if (cheap-list? type) - (lambda (m) - (any (lambda (t) (music-is-of-type? m t)) type)) - (lambda (m) (music-is-of-type? m type))))) + (extract-music music (music-type-predicate type))) (define*-public (event-chord-wrap! music) "Wrap isolated rhythmic events and non-postevent events in