;;;; This file is part of LilyPond, the GNU music typesetter.
;;;;
-;;;; Copyright (C) 2000--2014 Han-Wen Nienhuys <hanwen@xs4all.nl>
+;;;; Copyright (C) 2000--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
;;;; Jan Nieuwenhuizen <janneke@gnu.org>
;;;;
;;;; LilyPond is free software: you can redistribute it and/or modify
@end lilypond"
(interpret-markup layout props str))
+(define-markup-command (first-visible layout props args)
+ (markup-list?)
+ #:category other
+ "Use the first markup in @var{args} that yields a non-empty stencil
+and ignore the rest.
+
+@lilypond[verbatim,quote]
+\\markup {
+ \\first-visible {
+ \\fromproperty #'header:composer
+ \\italic Unknown
+ }
+}
+@end lilypond"
+ (define (false-if-empty stencil)
+ (if (ly:stencil-empty? stencil) #f stencil))
+ (or
+ (any
+ (lambda (m)
+ (if (markup? m)
+ (false-if-empty (interpret-markup layout props m))
+ (any false-if-empty (interpret-markup-list layout props (list m)))))
+ args)
+ empty-stencil))
+
(define-public empty-markup
(make-simple-markup ""))