Inside \fromproperty, simply change the props so that all references to the
currently interpreted property point to a function that prints out
a warning and returns a null markup, while interpreting the contents
of the property.
This is a specialized case of the cycle detection, since the hare+
tortoise algorithm does not tell us where the cycle was causes.
For properties we have a simple way to detect cyclic dependencies,
so we can tell the user which definition caused the problem.
;; property
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(define-markup-command (property-recursive layout props symbol)
+ (symbol?)
+ #:category other
+ "Print out a warning when a header field markup contains some recursive
+markup definition."
+ (ly:warning "Recursive definition of property ~a detected!" symbol)
+ empty-stencil)
+
(define-markup-command (fromproperty layout props symbol)
(symbol?)
#:category other
@end lilypond"
(let ((m (chain-assoc-get symbol props)))
(if (markup? m)
- (interpret-markup layout props m)
+ ;; prevent infinite loops by clearing the interpreted property:
+ (interpret-markup layout (cons (list (cons symbol `(,property-recursive-markup ,symbol))) props) m)
empty-stencil)))
(define-markup-command (on-the-fly layout props procedure arg)