;;;; This file is part of LilyPond, the GNU music typesetter.
;;;;
-;;;; Copyright (C) 1998--2011 Jan Nieuwenhuizen <janneke@gnu.org>
+;;;; Copyright (C) 1998--2012 Jan Nieuwenhuizen <janneke@gnu.org>
;;;; Han-Wen Nienhuys <hanwen@xs4all.nl>
;;;;
;;;; LilyPond is free software: you can redistribute it and/or modify
; for define-safe-public when byte-compiling using Guile V2
(use-modules (scm safe-utility-defs))
-;; (use-modules (ice-9 optargs))
+(use-modules (ice-9 optargs))
;;; ly:music-property with setter
;;; (ly:music-property my-music 'elements)
(inner-music-filter pred? e)
e))
(filtered-es (filter ly:music? (map (lambda (y) (inner-music-filter pred? y)) es))))
- (set! (ly:music-property music 'element) filtered-e)
- (set! (ly:music-property music 'elements) filtered-es)
- (set! (ly:music-property music 'articulations) filtered-as)
+ (if (not (null? e))
+ (set! (ly:music-property music 'element) filtered-e))
+ (if (not (null? es))
+ (set! (ly:music-property music 'elements) filtered-es))
+ (if (not (null? as))
+ (set! (ly:music-property music 'articulations) filtered-as))
;; if filtering emptied the expression, we remove it completely.
(if (or (not (pred? music))
(and (eq? filtered-es '()) (not (ly:music? e))
(use-modules (ice-9 pretty-print))
(define*-public (display-scheme-music obj #:optional (port (current-output-port)))
"Displays `obj', typically a music expression, in a friendly fashion,
-which often can be read back in order to generate an equivalent expression.
-
-Returns `obj'.
-"
+which often can be read back in order to generate an equivalent expression."
(pretty-print (music->make-music obj) port)
- (newline port)
- obj)
+ (newline port))
;;;
;;; Scheme music expression --> Lily-syntax-using string translator